summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-11-11 22:20:24 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-11-11 22:20:24 (GMT)
commit2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c (patch)
tree9b191cc644d578722593c6fe1aef96df90437dca /generic
parentb358779c9f4c39506f84b383f43f70736a410879 (diff)
downloadtcl-2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c.zip
tcl-2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c.tar.gz
tcl-2dc0d2ce91e0ef65ce9cbc9c886b63f8e9c26a0c.tar.bz2
* generic/tclBasic.c (Tcl_DeleteCommandFromToken):
* generic/tclObj.c (Tcl_GetCommandFromObj): bump the cmd epoch early to insure that cached references to this command are invalidated. Partial fix for [Bug 1352734] - at least insures that namespace-51.13 does not cause a panic. The test is still marked as knownbug, pending resolution of what is actually the correct return value ([Bug 1354540])
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c17
-rw-r--r--generic/tclObj.c4
2 files changed, 11 insertions, 10 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 4f61aed..ff87732 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.176 2005/10/09 20:05:17 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.177 2005/11/11 22:20:24 msofer Exp $
*/
#include "tclInt.h"
@@ -2462,6 +2462,13 @@ Tcl_DeleteCommandFromToken(interp, cmd)
Tcl_Command importCmd;
/*
+ * Bump the command epoch counter. This will invalidate all cached
+ * references that point to this command.
+ */
+
+ cmdPtr->cmdEpoch++;
+
+ /*
* The code here is tricky. We can't delete the hash table entry before
* invoking the deletion callback because there are cases where the
* deletion callback needs to invoke the command (e.g. object systems such
@@ -2563,13 +2570,6 @@ Tcl_DeleteCommandFromToken(interp, cmd)
}
/*
- * Bump the command epoch counter. This will invalidate all cached
- * references that point to this command.
- */
-
- cmdPtr->cmdEpoch++;
-
- /*
* If this command was imported into other namespaces, then imported
* commands were created that refer back to this command. Delete these
* imported commands now.
@@ -2591,6 +2591,7 @@ Tcl_DeleteCommandFromToken(interp, cmd)
if (cmdPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(cmdPtr->hPtr);
+ cmdPtr->hPtr = NULL;
}
/*
diff --git a/generic/tclObj.c b/generic/tclObj.c
index f5bee03..229c2ab 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -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: tclObj.c,v 1.97 2005/11/02 00:55:06 dkf Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.98 2005/11/11 22:20:24 msofer Exp $
*/
#include "tclInt.h"
@@ -3503,7 +3503,7 @@ Tcl_GetCommandFromObj(
&& (resPtr->refNsId == currNsPtr->nsId)
&& (resPtr->refNsCmdEpoch == currNsPtr->cmdRefEpoch)) {
cmdPtr = resPtr->cmdPtr;
- if (cmdPtr->cmdEpoch != resPtr->cmdEpoch) {
+ if ((cmdPtr->cmdEpoch != resPtr->cmdEpoch) || (cmdPtr->hPtr == NULL)) {
cmdPtr = NULL;
}
}