summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-11-14 00:41:05 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-11-14 00:41:05 (GMT)
commit9264d5ca1bd013c78fc5f822303ce4c03bde8c74 (patch)
tree6ca36e542384ebbf3ca170a55c48aae2d07c3394 /generic/tclNamesp.c
parentd6c73ab77833ab9488ab9930031dd0851a931cb4 (diff)
downloadtcl-9264d5ca1bd013c78fc5f822303ce4c03bde8c74.zip
tcl-9264d5ca1bd013c78fc5f822303ce4c03bde8c74.tar.gz
tcl-9264d5ca1bd013c78fc5f822303ce4c03bde8c74.tar.bz2
* generic/tclInt.h:
* generic/tclNamesp.c: * tests/namespace.test: fix for bugs #1354540 and #1355942. The new tests 7.3-6 and the modified 51.13 fail due to the unrelated [Bug 1355342] * tests/trace.test: added tests 20.13-16 for [Bug 1355342]
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 123a584..a1b81c0 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -21,7 +21,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.87 2005/11/12 23:15:50 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.88 2005/11/14 00:41:05 msofer Exp $
*/
#include "tclInt.h"
@@ -941,13 +941,17 @@ Tcl_DeleteNamespace(
}
}
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)) {
@@ -3277,13 +3281,14 @@ NamespaceDeleteCmd(
/*
* Destroying one namespace may cause another to be destroyed. Break this
* into two passes: first check to make sure that all namespaces on the
- * command line are valid, and report any errors.
+ * command line are valid, and report any errors.
*/
for (i = 2; i < objc; i++) {
name = TclGetString(objv[i]);
namespacePtr = Tcl_FindNamespace(interp, name, NULL, /*flags*/ 0);
- if (namespacePtr == NULL) {
+ if ((namespacePtr == NULL)
+ || (((Namespace *)namespacePtr)->flags & NS_KILLED)) {
Tcl_AppendResult(interp, "unknown namespace \"",
TclGetString(objv[i]),
"\" in namespace delete command", NULL);