summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-12-01 20:13:10 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-12-01 20:13:10 (GMT)
commit6caf77b9eeecd4f041db70af50a04337673ee602 (patch)
treea3ad3b6198cf39f4a3aba30bb87b91bc87d218c6 /generic/tclBasic.c
parent0e33bed46567780c4d5e5f700e4a6b986801a0b0 (diff)
downloadtcl-6caf77b9eeecd4f041db70af50a04337673ee602.zip
tcl-6caf77b9eeecd4f041db70af50a04337673ee602.tar.gz
tcl-6caf77b9eeecd4f041db70af50a04337673ee602.tar.bz2
Reports from NSF that command epoch bumping isn't properly timed.
http://paste.tclers.tk/4030 Since the epoch should bump to indicate when Tcl_FindCommand() would produce a different result from the cached value, the bump ought to be connected to the state change that would have that effect. This checkin appears to be the more correct answer, and it makes the Delete path get into agreement with the Rename path. Review would be good.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index c1dd52d..686c292 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,14 @@ 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++;
+
+ cmdPtr->cmdEpoch++;
}
/*