summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2004-07-15 21:17:03 (GMT)
committervasiljevic <zv@archiware.com>2004-07-15 21:17:03 (GMT)
commit2aebe9b17a5cf409268dbd8af3e7f7c2d1595846 (patch)
tree61ea47fb3d82c463b45221a13b82b22cdcd26ac3
parentd030c083e5dd7913feb8736f3727f316fe525876 (diff)
downloadtcl-2aebe9b17a5cf409268dbd8af3e7f7c2d1595846.zip
tcl-2aebe9b17a5cf409268dbd8af3e7f7c2d1595846.tar.gz
tcl-2aebe9b17a5cf409268dbd8af3e7f7c2d1595846.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--ChangeLog7
-rw-r--r--generic/tclNotify.c16
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a8e0256..90f7918 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,7 +30,7 @@
is accepted. [Tcl SF Bug 985869], reported by Joe Mistachkin
<mistachkin@users.sourceforge.net>.
-2004-07-15 Kevin Kenny <kennykb@acm.org>
+2004-07-15 Zoran Vasiljevic <vasiljevic@users.sf.net>
* generic/tclEvent.c (Tcl_Finalize): stuffed memory leak
incurred by re-initializing of TSD slots after the last call to
@@ -43,6 +43,11 @@
require TIP because some visible parts of Tcl API would have to
be modified. In the meantime, this will do.
+ * 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-15 Kevin Kenny <kennykb@acm.org>
* generic/tclLiteral.c (TclReleaseLiteral): Removed unused
diff --git a/generic/tclNotify.c b/generic/tclNotify.c
index 39a1cac..3f62d1a 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.14 2004/04/06 22:25:54 dgp Exp $
+ * RCS: @(#) $Id: tclNotify.c,v 1.15 2004/07/15 21:17:03 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -136,7 +136,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.
*
*----------------------------------------------------------------------
*/
@@ -148,6 +156,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;