Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.61
diff -u -r1.61 tclBasic.c
--- generic/tclBasic.c	20 Jun 2002 00:11:43 -0000	1.61
+++ generic/tclBasic.c	20 Jun 2002 16:00:49 -0000
@@ -3003,7 +3003,7 @@
     /*
      * Finally, invoke the command's Tcl_ObjCmdProc.
      */
-    
+    cmdPtr->refCount++;
     iPtr->cmdCount++;
     if ( code == TCL_OK && traceCode == TCL_OK) {
 	savedVarFramePtr = iPtr->varFramePtr;
@@ -3020,14 +3020,17 @@
     /*
      * Call 'leave' command traces
      */
-    if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && (traceCode == TCL_OK)) {
-	traceCode = TclCheckExecutionTraces(interp, command, length,
-		       cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
-    }
-    if (iPtr->tracePtr != NULL && traceCode == TCL_OK) {
-	traceCode = TclCheckInterpTraces(interp, command, length,
-		       cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
+    if (!(cmdPtr->flags & CMD_IS_DELETED)) {
+        if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && (traceCode == TCL_OK)) {
+            traceCode = TclCheckExecutionTraces (interp, command, length,
+                   cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
+        }
+        if (iPtr->tracePtr != NULL && traceCode == TCL_OK) {
+            traceCode = TclCheckInterpTraces(interp, command, length,
+                   cmdPtr, code, TCL_TRACE_LEAVE_EXEC, objc, objv);
+        }
     }
+    TclCleanupCommand(cmdPtr);
 
     /*
      * If one of the trace invocation resulted in error, then 
