summaryrefslogtreecommitdiffstats
path: root/generic/tclEvent.c
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2004-05-06 01:02:18 (GMT)
committerdavygrvy <davygrvy@pobox.com>2004-05-06 01:02:18 (GMT)
commit4f590a234bdd3971a2afe40a4640caedbcbb4408 (patch)
treee4321306b926c735c11e7dc28d9c8cdd391062ac /generic/tclEvent.c
parent19f4bee3fe8e26969721b630d634a8f4548479fb (diff)
downloadtcl-4f590a234bdd3971a2afe40a4640caedbcbb4408.zip
tcl-4f590a234bdd3971a2afe40a4640caedbcbb4408.tar.gz
tcl-4f590a234bdd3971a2afe40a4640caedbcbb4408.tar.bz2
* generic/tclEvent.c: TclSetLibraryPath's use of caching the
stringrep of the pathPtr object to TclGetLibraryPath called from another thread was ineffective if the original's stringrep had been invalidated as what happens when it gets muted to a list. * generic/tclInt.h: * generic/tclThread.c: * generic/tclEvent.c: * unix/tclUnixThrd.c: * win/tclWinThrd.c: Provisions made so masterLock, initLock, allocLock and joinLock mutexes can be recovered during Tcl_Finalize.
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r--generic/tclEvent.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 305a1e4..fb40447 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEvent.c,v 1.28.2.1 2003/05/13 12:44:07 dkf Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.28.2.2 2004/05/06 01:02:18 davygrvy Exp $
*/
#include "tclInt.h"
@@ -100,8 +100,9 @@ static Tcl_ThreadDataKey dataKey;
/*
* Common string for the library path for sharing across threads.
+ * This is ckalloc'd and cleared in Tcl_Finalize.
*/
-char *tclLibraryPathStr;
+static char *tclLibraryPathStr = NULL;
/*
* Prototypes for procedures referenced only in this file:
@@ -593,6 +594,8 @@ TclSetLibraryPath(pathPtr)
* the new library path. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+ const char *toDupe;
+ int size;
if (pathPtr != NULL) {
Tcl_IncrRefCount(pathPtr);
@@ -606,7 +609,12 @@ TclSetLibraryPath(pathPtr)
* No mutex locking is needed here as up the stack we're within
* TclpInitLock().
*/
- tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL);
+ if (tclLibraryPathStr != NULL) {
+ ckfree(tclLibraryPathStr);
+ }
+ toDupe = Tcl_GetStringFromObj(pathPtr, &size);
+ tclLibraryPathStr = ckalloc(size+1);
+ strcpy(tclLibraryPathStr, toDupe);
}
/*
@@ -842,6 +850,10 @@ Tcl_Finalize()
ckfree(tclDefaultEncodingDir);
tclDefaultEncodingDir = NULL;
}
+ if (tclLibraryPathStr != NULL) {
+ ckfree(tclLibraryPathStr);
+ tclLibraryPathStr = NULL;
+ }
Tcl_SetPanicProc(NULL);
@@ -877,7 +889,7 @@ Tcl_Finalize()
TclFinalizeMemorySubsystem();
inFinalize = 0;
}
- TclpInitUnlock();
+ TclFinalizeLock();
}
/*