Index: tests/destroy.test =================================================================== diff -u -r275da34d3d7a874a451eced58242b738c8a37d1a -rc29e5d3778a92e4bb20634fd67fed1b62f29c13d --- tests/destroy.test (.../destroy.test) (revision 275da34d3d7a874a451eced58242b738c8a37d1a) +++ tests/destroy.test (.../destroy.test) (revision c29e5d3778a92e4bb20634fd67fed1b62f29c13d) @@ -945,6 +945,38 @@ } # +# Test on UnsetTracedVars() under revived vars & unset traces +# +nx::test case unset-traces-during-cleanup-with-reset-2 { + global i + set i [interp create] + $i eval { + package req nx + set ::called(reset) 0 + proc ::reset {obj var value} { + # + # ... revive object variable 'x' and add yet another unset trace + # + ::nsf::var::set $obj $var $value + $obj eval [list ::trace add variable :$var unset \ + "incr ::called(reset); ::reset $obj $var $value; #"] + } + nx::Object create ::o + ::reset ::o x 100 + } + ? {$i eval {::nsf::object::exists ::o}} 1 + ? {$i eval {info commands ::o}} ::o + ? {$i eval {set ::called(reset)}} 0 + $i eval {::nsf::finalize -keepvars} + ? {$i eval {info commands ::o}} "" + ? {$i eval {set ::called(reset)}} 1; # unset trace, also re-registered, is only called once! + + interp delete $i + unset i +} + + +# # Exercise renaming of cmds which are used as methods # nx::test case rename-cached-method {