diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-20 13:38:17 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-20 13:38:17 (GMT) |
commit | 8bafabac9895be043d6bc198b1f1766240682ae6 (patch) | |
tree | 4057af9d22a34d893adece1a29ef67c9c2c20e4d /generic/tclNamesp.c | |
parent | 1bcaf97bfdcfc794caf8606cf3da5ddac8bc02d6 (diff) | |
parent | a15b801bfb5d91ea33543a69ca112cfdd4a848bb (diff) | |
download | tcl-8bafabac9895be043d6bc198b1f1766240682ae6.zip tcl-8bafabac9895be043d6bc198b1f1766240682ae6.tar.gz tcl-8bafabac9895be043d6bc198b1f1766240682ae6.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r-- | generic/tclNamesp.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index f4f4ac0..84d6894 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -402,7 +402,7 @@ Tcl_PopCallFrame( } if (framePtr->numCompiledLocals > 0) { TclDeleteCompiledLocalVars(iPtr, framePtr); - if (--framePtr->localCachePtr->refCount == 0) { + if (framePtr->localCachePtr->refCount-- <= 1) { TclFreeLocalCache(interp, framePtr->localCachePtr); } framePtr->localCachePtr = NULL; @@ -915,6 +915,11 @@ Tcl_DeleteNamespace( Command *cmdPtr; /* + * Ensure that this namespace doesn't get deallocated in the meantime. + */ + nsPtr->refCount++; + + /* * Give anyone interested - notably TclOO - a chance to use this namespace * normally despite the fact that the namespace is going to go. Allows the * calling of destructors. Will only be called once (unless re-established @@ -1046,16 +1051,8 @@ Tcl_DeleteNamespace( #endif Tcl_DeleteHashTable(&nsPtr->cmdTable); - /* - * If the reference count is 0, then discard the namespace. - * Otherwise, mark it as "dead" so that it can't be used. - */ - - if (nsPtr->refCount == 0) { - NamespaceFree(nsPtr); - } else { - nsPtr->flags |= NS_DEAD; - } + nsPtr ->flags |= NS_DEAD; + TclNsDecrRefCount(nsPtr); } else { /* * Restore the ::errorInfo and ::errorCode traces. |