From 6f97e75f52281eb769d51f15d7e07c3cd935a4d3 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Thu, 29 Aug 2002 19:02:19 +0000 Subject: * win/tclWinThrd.c (TclpFinalizeThreadData, TclWinFreeAllocCache): Applied patch for bug #599428, provided by Miguel Sofer . --- ChangeLog | 6 ++++++ win/tclWinThrd.c | 17 +++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea2f831..ecae9fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-08-29 Andreas Kupries + + * win/tclWinThrd.c (TclpFinalizeThreadData, TclWinFreeAllocCache): + Applied patch for bug #599428, provided by Miguel Sofer + . + 2002-08-28 David Gravereaux * generic/tclEnv.c: diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 10a886c..a00c672 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.19 2002/04/23 17:03:35 hobbs Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.20 2002/08/29 19:02:19 andreas_kupries Exp $ */ #include "tclWinInt.h" @@ -633,15 +633,10 @@ TclpFinalizeThreadData(keyPtr) { VOID *result; DWORD *indexPtr; -#ifdef USE_THREAD_ALLOC - static int once = 0; - if (!once) { - once = 1; - TclWinFreeAllocCache(); - } +#ifdef USE_THREAD_ALLOC + TclWinFreeAllocCache(); #endif - if (*keyPtr != NULL) { indexPtr = *(DWORD **)keyPtr; result = (VOID *)TlsGetValue(*indexPtr); @@ -1039,8 +1034,10 @@ TclWinFreeAllocCache(void) void *ptr; ptr = TlsGetValue(key); - TlsSetValue(key, NULL); - TclFreeAllocCache(ptr); + if (ptr != NULL) { + TlsSetValue(key, NULL); + TclFreeAllocCache(ptr); + } } #endif /* USE_THREAD_ALLOC */ -- cgit v0.12