diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdMZ.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ca1abef..a3dc03a 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.6 2003/07/16 08:24:20 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.7 2003/09/24 02:17:10 dgp Exp $ */ #include "tclInt.h" @@ -3350,6 +3350,7 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) resultListPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); while ((clientData = Tcl_CommandTraceInfo(interp, name, 0, TraceCommandProc, clientData)) != NULL) { + int numOps = 0; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *) clientData; @@ -3363,6 +3364,7 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) */ elemObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); + Tcl_IncrRefCount(elemObjPtr); if (tcmdPtr->flags & TCL_TRACE_ENTER_EXEC) { Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("enter",5)); @@ -3379,7 +3381,13 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("leavestep",9)); } + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); + if (0 == numOps) { + Tcl_DecrRefCount(elemObjPtr); + continue; + } Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); + Tcl_DecrRefCount(elemObjPtr); elemObjPtr = NULL; Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, @@ -3545,6 +3553,7 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) resultListPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); while ((clientData = Tcl_CommandTraceInfo(interp, name, 0, TraceCommandProc, clientData)) != NULL) { + int numOps = 0; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *) clientData; @@ -3558,6 +3567,7 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) */ elemObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); + Tcl_IncrRefCount(elemObjPtr); if (tcmdPtr->flags & TCL_TRACE_RENAME) { Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("rename",6)); @@ -3566,7 +3576,13 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("delete",6)); } + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); + if (0 == numOps) { + Tcl_DecrRefCount(elemObjPtr); + continue; + } Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); + Tcl_DecrRefCount(elemObjPtr); elemObjPtr = Tcl_NewStringObj(tcmdPtr->command, -1); Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); |