diff options
author | dgp <dgp@users.sourceforge.net> | 2007-06-27 17:29:20 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-06-27 17:29:20 (GMT) |
commit | 508902e0fee4e8981302823b171f4fb6ddb7f50d (patch) | |
tree | dc54a77e597ad6a8cdc37faa23c9ba1a796d2660 | |
parent | a384f578db158e03a8216ded58a85f751f9bc2a4 (diff) | |
download | tcl-508902e0fee4e8981302823b171f4fb6ddb7f50d.zip tcl-508902e0fee4e8981302823b171f4fb6ddb7f50d.tar.gz tcl-508902e0fee4e8981302823b171f4fb6ddb7f50d.tar.bz2 |
* generic/tclCmdMZ.c: Corrected broken trace reversal logic in
* generic/tclTest.c: TclCheckInterpTraces that led to infinite loop
* tests/basic.test: when multiple Tcl_CreateTrace traces were set and
one of them did not fire due to level restrictions. [Bug 1743931].
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 8 | ||||
-rw-r--r-- | generic/tclTest.c | 21 | ||||
-rw-r--r-- | tests/basic.test | 6 |
4 files changed, 34 insertions, 8 deletions
@@ -1,3 +1,10 @@ +2007-06-27 Don Porter <dgp@users.sourceforge.net> + + * generic/tclCmdMZ.c: Corrected broken trace reversal logic in + * generic/tclTest.c: TclCheckInterpTraces that led to infinite loop + * tests/basic.test: when multiple Tcl_CreateTrace traces were set and + one of them did not fire due to level restrictions. [Bug 1743931]. + 2007-06-23 Daniel Steffen <das@users.sourceforge.net> * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index b663f16..9114e50 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.28 2007/05/10 18:23:58 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.29 2007/06/27 17:29:22 dgp Exp $ */ #include "tclInt.h" @@ -4445,6 +4445,9 @@ TclCheckInterpTraces(interp, command, numChars, cmdPtr, code, active.nextTracePtr = tracePtr; tracePtr = tracePtr->nextPtr; } + if (active.nextTracePtr) { + lastTracePtr = active.nextTracePtr->nextPtr; + } } else { active.reverseScan = 0; active.nextTracePtr = tracePtr->nextPtr; @@ -4491,9 +4494,6 @@ TclCheckInterpTraces(interp, command, numChars, cmdPtr, code, tracePtr->flags &= ~TCL_TRACE_EXEC_IN_PROGRESS; Tcl_Release((ClientData) tracePtr); } - if (active.nextTracePtr) { - lastTracePtr = active.nextTracePtr->nextPtr; - } } iPtr->activeInterpTracePtr = active.nextPtr; return(traceCode); diff --git a/generic/tclTest.c b/generic/tclTest.c index 73ef0ab..433444b 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.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: tclTest.c,v 1.62.2.13 2006/09/22 01:26:23 andreas_kupries Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.62.2.14 2007/06/27 17:29:23 dgp Exp $ */ #define TCL_TEST @@ -1165,10 +1165,25 @@ TestcmdtraceCmd(dummy, interp, argc, argv) } else { return result; } - + } else if ( strcmp(argv[1], "doubletest" ) == 0 ) { + Tcl_Trace t1, t2; + + Tcl_DStringInit(&buffer); + t1 = Tcl_CreateTrace(interp, 1, + (Tcl_CmdTraceProc *) CmdTraceProc, (ClientData) &buffer); + t2 = Tcl_CreateTrace(interp, 50000, + (Tcl_CmdTraceProc *) CmdTraceProc, (ClientData) &buffer); + result = Tcl_Eval(interp, argv[2]); + if (result == TCL_OK) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), NULL); + } + Tcl_DeleteTrace(interp, t2); + Tcl_DeleteTrace(interp, t1); + Tcl_DStringFree(&buffer); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be tracetest, deletetest or resulttest", + "\": must be tracetest, deletetest, doubletest or resulttest", (char *) NULL); return TCL_ERROR; } diff --git a/tests/basic.test b/tests/basic.test index 0a995ba..b267c16 100644 --- a/tests/basic.test +++ b/tests/basic.test @@ -15,7 +15,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: basic.test,v 1.25.2.7 2005/03/18 16:33:43 dgp Exp $ +# RCS: @(#) $Id: basic.test,v 1.25.2.8 2007/06/27 17:29:24 dgp Exp $ # package require tcltest 2 @@ -564,6 +564,10 @@ test basic-39.10 {Tcl_CreateTrace, correct level interpretation} {testcmdtrace} testcmdtrace leveltest {foo} } {foo {foo} {uplevel 1 bar} {uplevel 1 bar} bar {bar} {uplevel 1 grok} {uplevel 1 grok}} +test basic-39.11 {Tcl_CreateTrace, multiple traces} {testcmdtrace} { + testcmdtrace doubletest {format xx} +} {{format xx} {format xx}} + test basic-40.1 {Tcl_DeleteTrace} {emptyTest} { # the above tests have tested Tcl_DeleteTrace } {} |