diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2005-10-29 17:45:22 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2005-10-29 17:45:22 (GMT) |
commit | 905504b25f37317b91c478e7a9fc1d5166250a73 (patch) | |
tree | c33d7e39d470aeab57cb502bab9c9e94316c545c | |
parent | 71b715c88b019bf819a112ac7e8b0aa68c6dc9e8 (diff) | |
download | tcl-905504b25f37317b91c478e7a9fc1d5166250a73.zip tcl-905504b25f37317b91c478e7a9fc1d5166250a73.tar.gz tcl-905504b25f37317b91c478e7a9fc1d5166250a73.tar.bz2 |
* generic/tclCmdMZ.c (TraceVarProc): [Bug 1337229], partial
fix. Insure that a second call with TCL_TRACE_DESTROYED does not
lead to a second call to Tcl_EventuallyFree(). It is still true
that that second call should not happen, so the bug is not
completely fixed.
* tests/trace.test (test-18.3-4): added tests for bugs #1337229
and 1338280.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 10 | ||||
-rw-r--r-- | tests/trace.test | 19 |
3 files changed, 34 insertions, 5 deletions
@@ -1,5 +1,15 @@ 2005-10-23 Miguel Sofer <msofer@users.sf.net> + * generic/tclCmdMZ.c (TraceVarProc): [Bug 1337229], partial + fix. Insure that a second call with TCL_TRACE_DESTROYED does not + lead to a second call to Tcl_EventuallyFree(). It is still true + that that second call should not happen, so the bug is not + completely fixed. + * tests/trace.test (test-18.3-4): added tests for bugs #1337229 + and 1338280. + +2005-10-23 Miguel Sofer <msofer@users.sf.net> + * generic/tclBasic.c: * generic/tclBinary.c: * generic/tclCmdAH.c: diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d1cb609..b2f5919 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.21 2005/10/23 22:01:29 msofer Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.22 2005/10/29 17:45:23 msofer Exp $ */ #include "tclInt.h" @@ -4694,7 +4694,7 @@ TraceVarProc(clientData, interp, name1, name2, flags) Tcl_SavedResult state; TraceVarInfo *tvarPtr = (TraceVarInfo *) clientData; char *result; - int code; + int code, destroy = 0; Tcl_DString cmd; /* @@ -4755,7 +4755,9 @@ TraceVarProc(clientData, interp, name1, name2, flags) */ Tcl_SaveResult(interp, &state); - if (flags & TCL_TRACE_DESTROYED) { + if ((flags & TCL_TRACE_DESTROYED) + && !(tvarPtr->flags & TCL_TRACE_DESTROYED)) { + destroy = 1; tvarPtr->flags |= TCL_TRACE_DESTROYED; } @@ -4772,7 +4774,7 @@ TraceVarProc(clientData, interp, name1, name2, flags) Tcl_DStringFree(&cmd); } } - if (flags & TCL_TRACE_DESTROYED) { + if (destroy) { if (result != NULL) { register Tcl_Obj *errMsgObj = (Tcl_Obj *) result; diff --git a/tests/trace.test b/tests/trace.test index 3e1f9bb..7862e4b 100644 --- a/tests/trace.test +++ b/tests/trace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: trace.test,v 1.26.2.8 2005/07/26 16:23:59 dgp Exp $ +# RCS: @(#) $Id: trace.test,v 1.26.2.9 2005/10/29 17:45:23 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1158,6 +1158,23 @@ test trace-18.2 {namespace delete / trace vdelete combo} { namespace delete ::foo info exists ::foo::x } 0 +test trace-18.3 {namespace delete / trace vdelete combo, Bug \#1337229} { + namespace eval ::ns {} + trace add variable ::ns::var unset {unset ::ns::var ;#} + namespace delete ::ns +} {} +test trace-18.4 {namespace delete / trace vdelete combo, Bug \#1338280} { + namespace eval ::ref {} + set ::ref::var1 AAA + trace add variable ::ref::var1 {unset} [list doTrace] + set ::ref::var2 BBB + trace add variable ::ref::var2 {unset} [list doTrace] + proc doTrace {vtraced vidx op} { + lappend ::witness [info vars ::ref::*] + } + namespace delete ::ref + lappend ::witness [info vars ::ref::*] +} {{::ref::var1 ::ref::var2} ::ref::var2 {}} # Delete arrays when done, so they can be re-used as scalars # elsewhere. |