diff options
author | dgp <dgp@users.sourceforge.net> | 2017-12-27 14:09:06 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-12-27 14:09:06 (GMT) |
commit | e9ccb8b496e10ebd8a3571cac98c587020c61333 (patch) | |
tree | e82ca71ee9c14353b028b8258a635fc92df88e22 /generic/tclNamesp.c | |
parent | 8ffa3470bbc737da1cac9d0d6fc0a1ae4a2397a8 (diff) | |
parent | 9a9b619c9f29470dab9e33b0c593b7e648224515 (diff) | |
download | tcl-e9ccb8b496e10ebd8a3571cac98c587020c61333.zip tcl-e9ccb8b496e10ebd8a3571cac98c587020c61333.tar.gz tcl-e9ccb8b496e10ebd8a3571cac98c587020c61333.tar.bz2 |
merge 8.7
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r-- | generic/tclNamesp.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 94245a2..a961ab4 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -933,6 +933,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 @@ -1064,16 +1069,7 @@ 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) { - NamespaceFree(nsPtr); - } else { - nsPtr->flags |= NS_DEAD; - } + nsPtr ->flags |= NS_DEAD; } else { /* * Restore the ::errorInfo and ::errorCode traces. @@ -1090,6 +1086,7 @@ Tcl_DeleteNamespace( nsPtr->flags &= ~(NS_DYING|NS_KILLED); } } + TclNsDecrRefCount(nsPtr); } /* |