diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2005-11-13 01:21:39 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2005-11-13 01:21:39 (GMT) |
commit | a01400deb8629465006faa71d0173f26abcb8e79 (patch) | |
tree | ea0d439cff075ea9dd2028ded8f0254be07a3c18 | |
parent | daf85fdee99c9921210b2c09e19c0c81f772e232 (diff) | |
download | tcl-a01400deb8629465006faa71d0173f26abcb8e79.zip tcl-a01400deb8629465006faa71d0173f26abcb8e79.tar.gz tcl-a01400deb8629465006faa71d0173f26abcb8e79.tar.bz2 |
* generic/tclBasic.c (Tcl_DeleteCommandFromToken):
* generic/tclObj.c (Tcl_GetCommandFromObj): more partial fixes for
[Bug 1354540] - making sure that cached references to a command
being deleted cannot be made reusable by a delete trace.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclBasic.c | 12 | ||||
-rw-r--r-- | generic/tclObj.c | 4 |
3 files changed, 12 insertions, 11 deletions
@@ -1,3 +1,10 @@ +2005-11-12 Miguel Sofer <msofer@users.sf.net> + + * generic/tclBasic.c (Tcl_DeleteCommandFromToken): + * generic/tclObj.c (Tcl_GetCommandFromObj): more partial fixes for + [Bug 1354540] - making sure that cached references to a command + being deleted cannot be made reusable by a delete trace. + 2005-11-12 Donal K. Fellows <dkf@users.sf.net> * generic/tclNamesp.c (Tcl_FindCommand): Do not find commands in dead diff --git a/generic/tclBasic.c b/generic/tclBasic.c index ace490a..125afe0 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.179 2005/11/12 02:01:10 das Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.180 2005/11/13 01:21:39 msofer Exp $ */ #include "tclInt.h" @@ -2441,13 +2441,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 @@ -2477,7 +2470,8 @@ Tcl_DeleteCommandFromToken( * may try to avoid this (renaming the command etc). Also traces and * delete procs may try to delete the command themsevles. This flag * declares that a delete is in progress and that recursive deletes should - * be ignored. + * be ignored. It also invalidates all cached references that point to + * this command. */ cmdPtr->flags |= CMD_IS_DELETED; diff --git a/generic/tclObj.c b/generic/tclObj.c index 229c2ab..e82d2dc 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.98 2005/11/11 22:20:24 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.99 2005/11/13 01:21:39 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) || (cmdPtr->hPtr == NULL)) { + if ((cmdPtr->cmdEpoch != resPtr->cmdEpoch) || (cmdPtr->flags & CMD_IS_DELETED)) { cmdPtr = NULL; } } |