summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-11-18 23:07:26 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-11-18 23:07:26 (GMT)
commitc97535ea03fe482ec1293e11b276eb40fd2faeb8 (patch)
tree55f1b4ed5f653180f0ac89f9dfb2510b141648c0 /generic/tclNamesp.c
parentcb651f0210eff616b6ee84c8c2146bd5f1f2f320 (diff)
downloadtcl-c97535ea03fe482ec1293e11b276eb40fd2faeb8.zip
tcl-c97535ea03fe482ec1293e11b276eb40fd2faeb8.tar.gz
tcl-c97535ea03fe482ec1293e11b276eb40fd2faeb8.tar.bz2
* generic/tclBasic.c (Tcl_DeleteCommandFromToken):
* generic/tclCmdMZ.c (TraceCommandProc): * generic/tclInt.h (NS_KILLED): * generic/tclNamesp.c (Tcl_DeleteNamespace * tests/namespace.test (namespace-7.3-6): * tests/trace.test (trace-20.13-16): fix [Bugs 1355942/1355342].
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 029051c..0400c1e 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -19,7 +19,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.31.2.9 2005/11/04 01:15:20 msofer Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.31.2.10 2005/11/18 23:07:27 msofer Exp $
*/
#include "tclInt.h"
@@ -612,13 +612,17 @@ Tcl_DeleteNamespace(namespacePtr)
}
}
nsPtr->parentPtr = NULL;
- } else {
+ } else if (!(nsPtr->flags & NS_KILLED)) {
/*
* Delete the namespace and everything in it. If this is the global
* namespace, then clear it but don't free its storage unless the
- * interpreter is being torn down.
+ * interpreter is being torn down. Set the NS_KILLED flag to avoid
+ * recursive calls here - if the namespace is really in the process of
+ * being deleted, ignore any second call.
*/
+ nsPtr->flags |= (NS_DYING|NS_KILLED);
+
TclTeardownNamespace(nsPtr);
if ((nsPtr != globalNsPtr) || (iPtr->flags & DELETED)) {
@@ -2048,11 +2052,12 @@ Tcl_FindCommand(interp, name, contextNsPtr, flags)
if ((nsPtr[search] != NULL) && (simpleName != NULL)) {
entryPtr = Tcl_FindHashEntry(&nsPtr[search]->cmdTable,
simpleName);
- if (entryPtr != NULL) {
- cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
- }
- }
+ if (entryPtr != NULL) {
+ cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
+ }
+ }
}
+
if (cmdPtr != NULL) {
return (Tcl_Command) cmdPtr;
} else if (flags & TCL_LEAVE_ERR_MSG) {
@@ -2887,7 +2892,7 @@ NamespaceDeleteCmd(dummy, interp, objc, objv)
name = Tcl_GetString(objv[i]);
namespacePtr = Tcl_FindNamespace(interp, name,
(Tcl_Namespace *) NULL, /*flags*/ 0);
- if (namespacePtr == NULL) {
+ if (namespacePtr == NULL) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"unknown namespace \"", Tcl_GetString(objv[i]),
"\" in namespace delete command", (char *) NULL);