Tcl Source Code

Artifact [0e4bf4b22c]
Login

Artifact 0e4bf4b22c6f204e43f18d20051065bfa97d1ef0:

Attachment "arrayTrace.patch" to ticket [484339ffff] added by msofer 2001-12-07 02:58:16.
Index: generic/tclVar.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclVar.c,v
retrieving revision 1.43
diff -r1.43 tclVar.c
4516a4517,4519
>     if (arrayPtr != NULL) {
> 	arrayPtr->refCount++;
>     }
4559d4561
< 	arrayPtr->refCount++;
Index: tests/trace.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/trace.test,v
retrieving revision 1.15
diff -r1.15 trace.test
58a59,70
> 
> test trace-0.0 {memory corruption in trace (Tcl Bug 484339)} {
>     # You may need Purify or Electric Fence to reliably
>     # see this one fail.
>     catch {unset z}
>     trace add variable z array {set z(foo) 1 ;#}
>     set res "names: [array names z]"
>     catch {unset ::z}
>     trace variable ::z w {unset ::z; error "memory corruption";#}
>     list [catch {set ::z 1} msg] $msg
> } {1 {can't set "::z": memory corruption}}
> 
916c928
< } "{x y z} a\\n\\{ write"
---
> } "{x y z} a\\n\\\{ write"