diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2001-12-14 10:32:47 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2001-12-14 10:32:47 (GMT) |
commit | 47109e8be05c52fd33c2a67b1929ed3c19479787 (patch) | |
tree | 2bbad404c789cc6c29f6b2df6246e2941721bd11 /win | |
parent | 6bdf240232929cf73bc0cafdbd6d416b9881d2be (diff) | |
download | tcl-47109e8be05c52fd33c2a67b1929ed3c19479787.zip tcl-47109e8be05c52fd33c2a67b1929ed3c19479787.tar.gz tcl-47109e8be05c52fd33c2a67b1929ed3c19479787.tar.bz2 |
* 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...
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinNotify.c | 16 |
1 files changed, 15 insertions, 1 deletions
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); |