diff options
author | hobbs <hobbs> | 2002-02-27 01:26:51 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-02-27 01:26:51 (GMT) |
commit | 9c3d7b330c6545c3c8c5e1d0d7b5edc45d819e3d (patch) | |
tree | e9444b3be73e0c6546dfdfbe1f63f8a113830872 | |
parent | 86764e54e982f3d9898fcb2f0fc0561bda497a49 (diff) | |
download | tk-9c3d7b330c6545c3c8c5e1d0d7b5edc45d819e3d.zip tk-9c3d7b330c6545c3c8c5e1d0d7b5edc45d819e3d.tar.gz tk-9c3d7b330c6545c3c8c5e1d0d7b5edc45d819e3d.tar.bz2 |
* generic/tkWindow.c (Tk_MainWindow, Tk_GetNumMainWindows):
protect against being called before Tcl stubs are init'ed.
[Bug #220916] (porter)
-rw-r--r-- | generic/tkWindow.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 0c82898..7975b54 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.42 2002/02/22 02:41:17 hobbs Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.43 2002/02/27 01:26:51 hobbs Exp $ */ #include "tkPort.h" @@ -2503,8 +2503,18 @@ Tk_MainWindow(interp) * reporting also. */ { TkMainInfo *mainPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + ThreadSpecificData *tsdPtr; + + if (interp == NULL) { + return NULL; + } +#ifdef USE_TCL_STUBS + if (tclStubsPtr == NULL) { + return NULL; + } +#endif + tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { @@ -2628,8 +2638,16 @@ OpenIM(dispPtr) int Tk_GetNumMainWindows() { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + ThreadSpecificData *tsdPtr; + +#ifdef USE_TCL_STUBS + if (tclStubsPtr == NULL) { + return 0; + } +#endif + + tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->numMainWindows; } |