summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-06-14 13:45:57 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-06-14 13:45:57 (GMT)
commit9480f190e5c0b49511894e60db3c34b9a7a81003 (patch)
tree8753974f9a48a1a793cb9bd53171a42b17f86238 /generic
parentcdd600c79b33458ca7ca7861563f1c6756e69ff6 (diff)
downloadtcl-9480f190e5c0b49511894e60db3c34b9a7a81003.zip
tcl-9480f190e5c0b49511894e60db3c34b9a7a81003.tar.gz
tcl-9480f190e5c0b49511894e60db3c34b9a7a81003.tar.bz2
Fix [Bug 1220058] and quash a bizarre case which generated a bogus error msg.
Thanks to Will Duquette for helping to track this one down.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c13
-rw-r--r--generic/tclTrace.c8
2 files changed, 16 insertions, 5 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 6935782..42f5465 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.160 2005/06/06 23:45:43 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.161 2005/06/14 13:46:02 dkf Exp $
*/
#include "tclInt.h"
@@ -2504,11 +2504,16 @@ Tcl_DeleteCommandFromToken(interp, cmd)
/*
* Another deletion is already in progress. Remove the hash
* table entry now, but don't invoke a callback or free the
- * command structure.
+ * command structure. Take care to only remove the hash entry
+ * if it has not already been removed; otherwise if we manage
+ * to hit this function three times, everything goes up in
+ * smoke. [Bug 1220058]
*/
- Tcl_DeleteHashEntry(cmdPtr->hPtr);
- cmdPtr->hPtr = NULL;
+ if (cmdPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(cmdPtr->hPtr);
+ cmdPtr->hPtr = NULL;
+ }
return 0;
}
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 3a15ac8..d482a6b 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTrace.c,v 1.23 2005/05/10 18:34:51 kennykb Exp $
+ * RCS: @(#) $Id: tclTrace.c,v 1.24 2005/06/14 13:46:03 dkf Exp $
*/
#include "tclInt.h"
@@ -1284,6 +1284,7 @@ TraceCommandProc(clientData, interp, oldName, newName, flags)
*/
if (flags & (TCL_TRACE_DESTROYED | TCL_TRACE_DELETE)) {
int untraceFlags = tcmdPtr->flags;
+ Tcl_InterpState state;
if (tcmdPtr->stepTrace != NULL) {
Tcl_DeleteTrace(interp, tcmdPtr->stepTrace);
@@ -1315,9 +1316,14 @@ TraceCommandProc(clientData, interp, oldName, newName, flags)
* Remove the trace since TCL_TRACE_DESTROYED tells us to, or the
* command we're tracing has just gone away. Then decrement the
* clientData refCount that was set up by trace creation.
+ *
+ * Note that we save the (return) state of the interpreter to
+ * prevent bizarre error messages.
*/
+ state = Tcl_SaveInterpState(interp, TCL_OK);
Tcl_UntraceCommand(interp, oldName, untraceFlags,
TraceCommandProc, clientData);
+ (void) Tcl_RestoreInterpState(interp, state);
tcmdPtr->refCount--;
}
if ((--tcmdPtr->refCount) <= 0) {