diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | win/tclWinNotify.c | 16 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,11 @@ +2001-12-14 Donal K. Fellows <fellowsd@cs.man.ac.uk> + + * win/tclWinNotify.c (Tcl_FinalizeNotifier): Stop Tcl on Windows + from crashing when shutdown from a non-Tcl thread. Fixes Bug + #217982 [orig. 5804] reported by Hugh Vu and Gene Leache. I'm + not convinced that the shutdown process is right even with this, + but it was definitely wrong without... + 2001-12-13 Andreas Kupries <andreas_kupries@users.sourceforge.net> * win/tclWinSock.c (TcpGetOptionProc): Fix for tcl bug item diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index d788086..5df1e8d 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinNotify.c,v 1.9 2001/11/21 02:36:21 hobbs Exp $ + * RCS: @(#) $Id: tclWinNotify.c,v 1.10 2001/12/14 10:32:47 dkf Exp $ */ #include "tclWinInt.h" @@ -147,6 +147,20 @@ Tcl_FinalizeNotifier(clientData) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData; + /* + * Only finalize the notifier if a notifier was installed in the + * current thread; there is a route in which this is not + * guaranteed to be true (when tclWin32Dll.c:DllMain() is called + * with the flag DLL_PROCESS_DETACH by the OS, which could be + * doing so from a thread that's never previously been involved + * with Tcl, e.g. the task manager) so this check is important. + * + * Fixes Bug #217982 reported by Hugh Vu and Gene Leache. + */ + if (tsdPtr == NULL) { + return; + } + DeleteCriticalSection(&tsdPtr->crit); CloseHandle(tsdPtr->event); |