From 6caf77b9eeecd4f041db70af50a04337673ee602 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 1 Dec 2016 20:13:10 +0000 Subject: 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. --- generic/tclBasic.c | 23 ++++++++++++++++------- 1 file 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++; } /* -- cgit v0.12