diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-10-11 21:52:57 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-10-11 21:52:57 (GMT) |
commit | 7dd13b72b6620cba05c004b954ea3df251420910 (patch) | |
tree | 4a830dcdd04884ee7552dabfd033c6428ec70f0f | |
parent | 11e9b6a9a5b0d4c50831216c87d9357518e71a30 (diff) | |
parent | 54c0881e9d6deab242839da14f2f4d3dfe05df5b (diff) | |
download | tcl-7dd13b72b6620cba05c004b954ea3df251420910.zip tcl-7dd13b72b6620cba05c004b954ea3df251420910.tar.gz tcl-7dd13b72b6620cba05c004b954ea3df251420910.tar.bz2 |
Fix [3cc1d91345]: duplicate calls to TclpFreeAllocCache() on thread exists
-rw-r--r-- | generic/tclThreadAlloc.c | 6 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 2 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 2 | ||||
-rw-r--r-- | unix/tclUnixThrd.c | 10 | ||||
-rw-r--r-- | win/tclWinThrd.c | 6 |
5 files changed, 17 insertions, 9 deletions
diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 018f006..2ee758e 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -1106,9 +1106,9 @@ TclFinalizeThreadAlloc(void) * * TclFinalizeThreadAllocThread -- * - * This procedure is used to destroy single thread private resources used - * in this file. - * Called in TclpFinalizeThreadData when a thread exits (Tcl_FinalizeThread). + * This procedure is used to destroy single thread private resources + * defined in this file. Called either during Tcl_FinalizeThread() or + * Tcl_Finalize(). * * Results: * None. diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 91fb986..31177a3 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -761,7 +761,7 @@ TclpSetVariables( CFLocaleRef localeRef; - if (CFLocaleCopyCurrent != NULL && CFLocaleGetIdentifier != NULL && + if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL && (localeRef = CFLocaleCopyCurrent())) { CFStringRef locale = CFLocaleGetIdentifier(localeRef); diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index ff1f62e..5d11a28 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1474,7 +1474,7 @@ Tcl_OpenTcpServer( } retry++; chosenport = 0; - + if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) { my_errno = errno; goto error; diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 8f8eb7f..7394545 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -712,7 +712,7 @@ void TclpInitAllocCache(void) { pthread_mutex_lock(allocLockPtr); - pthread_key_create(&key, TclpFreeAllocCache); + pthread_key_create(&key, NULL); pthread_mutex_unlock(allocLockPtr); } @@ -722,13 +722,19 @@ TclpFreeAllocCache( { if (ptr != NULL) { /* - * Called by the pthread lib when a thread exits + * Called by TclFinalizeThreadAllocThread() during the thread + * finalization initiated from Tcl_FinalizeThread() */ TclFreeAllocCache(ptr); pthread_setspecific(key, NULL); } else { + /* + * Called by TclFinalizeThreadAlloc() during the process + * finalization initiated from Tcl_Finalize() + */ + pthread_key_delete(key); } } diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 26d745d..e46b0a0 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -1008,8 +1008,10 @@ TclpFreeAllocCache( if (ptr != NULL) { /* - * Called by us in TclpFinalizeThreadData when a thread exits and - * destroys the tsd key which stores allocator caches. + * Called by TclFinalizeThreadAlloc() and + * TclFinalizeThreadAllocThread() during Tcl_Finalize() or + * Tcl_FinalizeThread(). This function destroys the tsd key which + * stores allocator caches in thread local storage. */ TclFreeAllocCache(ptr); |