Attachment "tclWinThrd.patch" to
ticket [599428ffff]
added by
msofer
2002-08-24 04:32:19.
Index: tclWinThrd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinThrd.c,v
retrieving revision 1.19
diff -u -r1.19 tclWinThrd.c
--- tclWinThrd.c 23 Apr 2002 17:03:35 -0000 1.19
+++ tclWinThrd.c 23 Aug 2002 21:28:37 -0000
@@ -633,15 +633,10 @@
{
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 @@
void *ptr;
ptr = TlsGetValue(key);
- TlsSetValue(key, NULL);
- TclFreeAllocCache(ptr);
+ if (ptr != NULL) {
+ TlsSetValue(key, NULL);
+ TclFreeAllocCache(ptr);
+ }
}
#endif /* USE_THREAD_ALLOC */