From 3ec15d47f45aee77ef86ca5943b8c7624c37718c Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 4 Dec 2002 07:07:58 +0000 Subject: * generic/tclStubLib.c (Tcl_InitStubs): prevent the cached check of tclStubsPtr to allow for repeated load/unload of the Tcl dll by hosting apps. [Bug 615304] --- ChangeLog | 6 ++++++ generic/tclStubLib.c | 26 +++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a872fb..545d1b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-12-03 Jeff Hobbs + + * generic/tclStubLib.c (Tcl_InitStubs): prevent the cached check of + tclStubsPtr to allow for repeated load/unload of the Tcl dll by + hosting apps. [Bug 615304] + 2002-12-03 David Gravereaux * win/tclAppInit.c (sigHandler): Protect from trying to close a diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index f1f165e..c650dac 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.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: tclStubLib.c,v 1.5 2001/04/04 16:07:21 kennykb Exp $ + * RCS: @(#) $Id: tclStubLib.c,v 1.6 2002/12/04 07:07:59 hobbs Exp $ */ /* @@ -36,10 +36,10 @@ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT -TclStubs *tclStubsPtr; -TclPlatStubs *tclPlatStubsPtr; -TclIntStubs *tclIntStubsPtr; -TclIntPlatStubs *tclIntPlatStubsPtr; +TclStubs *tclStubsPtr = NULL; +TclPlatStubs *tclPlatStubsPtr = NULL; +TclIntStubs *tclIntStubsPtr = NULL; +TclIntPlatStubs *tclIntPlatStubsPtr = NULL; static TclStubs * HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp)); @@ -86,14 +86,18 @@ Tcl_InitStubs (interp, version, exact) CONST char *version; int exact; { - CONST char *actualVersion; + CONST char *actualVersion = NULL; TclStubs *tmp; - + + /* + * We can't optimize this check by caching tclStubsPtr because + * that prevents apps from being able to load/unload Tcl dynamically + * multiple times. [Bug 615304] + */ + + tclStubsPtr = HasStubSupport(interp); if (!tclStubsPtr) { - tclStubsPtr = HasStubSupport(interp); - if (!tclStubsPtr) { - return NULL; - } + return NULL; } actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, exact, -- cgit v0.12