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
