Tcl Source Code

Artifact [92b2bdc82d]
Login

Artifact 92b2bdc82d277cf36063ddb00b86a972617ee995:

Attachment "1201035.patch" to ticket [1201035fff] added by dgp 2005-06-21 10:16:11.
Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.75.2.14
diff -u -r1.75.2.14 tclBasic.c
--- generic/tclBasic.c	18 Mar 2005 16:33:41 -0000	1.75.2.14
+++ generic/tclBasic.c	21 Jun 2005 02:38:29 -0000
@@ -5160,6 +5160,7 @@
     Interp *iPtr = (Interp *) interp;
     Trace *tracePtr = (Trace *) trace;
     register Trace **tracePtr2 = &(iPtr->tracePtr);
+    ActiveInterpTrace *activePtr;
 
     /*
      * Locate the trace entry in the interpreter's trace list,
@@ -5175,6 +5176,19 @@
     (*tracePtr2) = (*tracePtr2)->nextPtr;
 
     /*
+     * The code below makes it possible to delete traces while traces
+     * are active: it makes sure that the deleted trace won't be
+     * processed by TclCheckInterpTraces.
+     */
+
+    for (activePtr = iPtr->activeInterpTracePtr;  activePtr != NULL;
+	    activePtr = activePtr->nextPtr) {
+	if (activePtr->nextTracePtr == tracePtr) {
+	    activePtr->nextTracePtr = tracePtr->nextPtr;
+	}
+    }
+
+    /*
      * If the trace forbids bytecode compilation, change the interpreter's
      * state.  If bytecode compilation is now permitted, flag the fact and
      * advance the compilation epoch so that procs will be recompiled to