summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-12-02 15:39:31 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-12-02 15:39:31 (GMT)
commit1782f8677925d45e83402a7f1fac4f4b0e1e367b (patch)
tree28399f6d7a87b02906c3772dae81a2671b82f60a /generic/tclBasic.c
parent7fc5eaa4ef6c217255f1030b30c5a68eac04a052 (diff)
parent180d65597c93cce39ee129e23289196d2b40a589 (diff)
downloadtcl-1782f8677925d45e83402a7f1fac4f4b0e1e367b.zip
tcl-1782f8677925d45e83402a7f1fac4f4b0e1e367b.tar.gz
tcl-1782f8677925d45e83402a7f1fac4f4b0e1e367b.tar.bz2
Relocate the cmdEpoch bumps during command deletion so that command resolution
caching works properly in deletion callbacks (destructors!) and delete traces.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index c1dd52d..81b3513 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -3024,13 +3024,6 @@ Tcl_DeleteCommandFromToken(
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
@@ -3052,6 +3045,14 @@ Tcl_DeleteCommandFromToken(
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = NULL;
}
+
+ /*
+ * Bump the command epoch counter. This will invalidate all cached
+ * references that point to this command.
+ */
+
+ cmdPtr->cmdEpoch++;
+
return 0;
}
@@ -3154,6 +3155,13 @@ Tcl_DeleteCommandFromToken(
if (cmdPtr->hPtr != NULL) {
Tcl_DeleteHashEntry(cmdPtr->hPtr);
cmdPtr->hPtr = NULL;
+
+ /*
+ * Bump the command epoch counter. This will invalidate all cached
+ * references that point to this command.
+ */
+
+ cmdPtr->cmdEpoch++;
}
/*