summaryrefslogtreecommitdiffstats
path: root/generic
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
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')
-rw-r--r--generic/tclInt.h5
-rw-r--r--generic/tclNamesp.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 480507d..8558e14 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.257 2005/11/12 04:08:05 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.258 2005/11/14 00:41:05 msofer Exp $
*/
#ifndef _TCLINT
@@ -308,10 +308,13 @@ struct NamespacePathEntry {
* unit that refers to the namespace has been freed (i.e., when
* the namespace's refCount is 0), the namespace's storage will
* be freed.
+ * NS_KILLED 1 means that TclTeardownNamespace has already been called on
+ * this namespace and it should not be called again [Bug 1355942]
*/
#define NS_DYING 0x01
#define NS_DEAD 0x02
+#define NS_KILLED 0x04
/*
* Flags passed to TclGetNamespaceForQualName:
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);