diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win/tclWinThrd.c | 17 |
2 files changed, 13 insertions, 10 deletions
@@ -1,3 +1,9 @@ +2002-08-29 Andreas Kupries <andreas_kupries@users.sourceforge.net> + + * win/tclWinThrd.c (TclpFinalizeThreadData, TclWinFreeAllocCache): + Applied patch for bug #599428, provided by Miguel Sofer + <msofer@users.sourceforge.net>. + 2002-08-28 David Gravereaux <davygrvy@pobox.com> * 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 */ |