summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2004-07-15 21:20:24 (GMT)
committervasiljevic <zv@archiware.com>2004-07-15 21:20:24 (GMT)
commitf1672e88f2ba0cd791ed0ef2b4196696cf993c5c (patch)
tree406f4edeca9bed43cc97046d91419f648b9602d4
parent597bb3236aba9dbe1c799b8bde917c1228fd21a1 (diff)
downloadtcl-f1672e88f2ba0cd791ed0ef2b4196696cf993c5c.zip
tcl-f1672e88f2ba0cd791ed0ef2b4196696cf993c5c.tar.gz
tcl-f1672e88f2ba0cd791ed0ef2b4196696cf993c5c.tar.bz2
Added new fix for the Tcl Bug #770053. Now we conditionaly perform
the TclFinalizeNotifier in order to correct broken ref-counting of the notifier thread.
-rw-r--r--ChangeLog10
-rw-r--r--generic/tclNotify.c16
2 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 99ffef6..85a6979 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-07-15 Zoran Vasiljevic <vasiljevic@users.sf.net>
+
+ * generic/tclEvent.c (NewThreadProc): Backout of changes
+ to fix the Tcl Bug #770053. See SF bugreport for more info.
+
+ * generic/tclNotify.c (TclFinalizeNotifier): Added conditional
+ notifier finalization based on the fact that an TclInitNotifier
+ has been called for the current thread. This fixes the Tcl
+ Bug #770053 again. Hopefully this time w/o unwanted side-effects.
+
2004-07-14 Andreas Kupries <andreask@activestate.com>
* generic/tclIO.h (CHANNEL_INCLOSE): New flag. Set in
diff --git a/generic/tclNotify.c b/generic/tclNotify.c
index d312e6c..abd4e04 100644
--- a/generic/tclNotify.c
+++ b/generic/tclNotify.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNotify.c,v 1.11 2003/02/15 20:24:10 kennykb Exp $
+ * RCS: @(#) $Id: tclNotify.c,v 1.11.2.1 2004/07/15 21:20:25 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -137,7 +137,15 @@ TclInitNotifier()
*
* Side effects:
* Removes the notifier associated with the current thread from
- * the global notifier list.
+ * the global notifier list. This is done only if the notifier
+ * was initialized for this thread by call to TclInitNotifier().
+ * This is always true for threads which have been seeded with
+ * an Tcl interpreter, since the call to Tcl_CreateInterp will,
+ * among other things, call TclInitializeSubsystems() and this
+ * one will, in turn, call the TclInitNotifier() for the thread.
+ * For threads created without the Tcl interpreter, though,
+ * nobody is explicitly nor implicitly calling the TclInitNotifier
+ * hence, TclFinalizeNotifier should not be performed at all.
*
*----------------------------------------------------------------------
*/
@@ -149,6 +157,10 @@ TclFinalizeNotifier()
ThreadSpecificData **prevPtrPtr;
Tcl_Event *evPtr, *hold;
+ if (tsdPtr->threadId == (Tcl_ThreadId)0) {
+ return; /* Notifier not initialized for the current thread */
+ }
+
Tcl_MutexLock(&(tsdPtr->queueMutex));
for (evPtr = tsdPtr->firstEventPtr; evPtr != (Tcl_Event *) NULL; ) {
hold = evPtr;