summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-10-11 21:43:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-10-11 21:43:44 (GMT)
commitde46d7767eadf5c2cdf992a3abd1413e15662674 (patch)
tree6ec54166e1a86a7d7a558c818ffc68b1a294cad1
parent04ea07263f1075d0b484d36c21726daf94cdd02f (diff)
parentc20fffb1c16d1b8a7ed25de25f292df6297d176f (diff)
downloadtcl-de46d7767eadf5c2cdf992a3abd1413e15662674.zip
tcl-de46d7767eadf5c2cdf992a3abd1413e15662674.tar.gz
tcl-de46d7767eadf5c2cdf992a3abd1413e15662674.tar.bz2
Fix [3cc1d91345]: duplicate calls to TclpFreeAllocCache() on thread exists
-rw-r--r--generic/tclThreadAlloc.c6
-rw-r--r--unix/tclUnixInit.c2
-rw-r--r--unix/tclUnixThrd.c7
-rw-r--r--win/tclWinThrd.c6
4 files changed, 12 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 5fc0035..badfb36 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -769,7 +769,7 @@ TclpSetVariables(
CFLocaleRef localeRef;
- if (CFLocaleCopyCurrent != NULL && CFLocaleGetIdentifier != NULL &&
+ if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL &&
(localeRef = CFLocaleCopyCurrent())) {
CFStringRef locale = CFLocaleGetIdentifier(localeRef);
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index ea03332..9757e4e 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -722,7 +722,8 @@ 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);
@@ -730,7 +731,7 @@ TclpFreeAllocCache(
} else if (initialized) {
/*
- * Called by us in TclFinalizeThreadAlloc() during the library
+ * Called by TclFinalizeThreadAlloc() during the process
* finalization initiated from Tcl_Finalize()
*/
@@ -745,7 +746,7 @@ TclpGetAllocCache(void)
if (!initialized) {
pthread_mutex_lock(allocLockPtr);
if (!initialized) {
- pthread_key_create(&key, TclpFreeAllocCache);
+ pthread_key_create(&key, NULL);
initialized = 1;
}
pthread_mutex_unlock(allocLockPtr);
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index ca26f08..8f3ddb9 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -1012,8 +1012,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);