diff options
author | ericm <ericm@noemail.net> | 2000-01-15 02:52:32 (GMT) |
---|---|---|
committer | ericm <ericm@noemail.net> | 2000-01-15 02:52:32 (GMT) |
commit | 3302dc21ea1687a32beeae413aa43a35abd108da (patch) | |
tree | f0a48e84b923fb854ce92e859f9387305788cda0 /tests | |
parent | 4d6dd6b2c3466b1da660e6ef45643231ccff2446 (diff) | |
download | tcl-3302dc21ea1687a32beeae413aa43a35abd108da.zip tcl-3302dc21ea1687a32beeae413aa43a35abd108da.tar.gz tcl-3302dc21ea1687a32beeae413aa43a35abd108da.tar.bz2 |
* tests/var.test: Added a test for the array multiple delete
protection in Tcl_UnsetVar2.
* generic/tclVar.c: Added protection in Tcl_UnsetVar2 against
attempts to multiply delete arrays when unsetting them (bug
#3453). This could happen if there was an unset trace on an array
element and the trace proc made a global or upvar link to the
array, and then the array was unset at the global level. See the
bug reference for more information.
FossilOrigin-Name: f0922bda2d3f3ce7007f5a9ac7749465a40f363f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/var.test | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/var.test b/tests/var.test index b18e0ae..e72014c 100644 --- a/tests/var.test +++ b/tests/var.test @@ -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: var.test,v 1.10 1999/12/12 02:27:04 hobbs Exp $ +# RCS: @(#) $Id: var.test,v 1.11 2000/01/15 02:52:32 ericm Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -617,6 +617,19 @@ test var-12.1 {TclFindCompiledLocals, {} array name} { } } {0 1 2 2,foo} +test var-13.1 {Tcl_UnsetVar2, unset array with trace set on element} { + proc foo {var ind op} { + global t + set foo bar + } + namespace eval :: { + set t(1) 1 + trace variable t(1) u foo + unset t + } + set x "If you see this, it worked" +} "If you see this, it worked" + catch {namespace delete ns} catch {unset arr} catch {unset v} |