#4797 TclOO variable unset problem

obsolete: 8.6b1.1
closed-fixed
9
2011-09-22
2011-02-17
Koen Danckaert
No

There is a problem when configuring object variables using objdefine->variable, and unsetting such a variable:

oo::object create p
oo::objdefine p variable x
oo::objdefine p method set {v} {set x $v}
oo::objdefine p method unset {} {unset x}
oo::objdefine p method exists {} {info exists x}
oo::objdefine p method get {} {return $x}

p exists ; # returns 0 (ok)
p set 7
p exists ; # returns 1 (ok)
p get ; # returns 7 (ok)
p unset
p exists ; # returns 1 (wrong)
p get ; # Segmentation fault

The above is when running interactively. In non-interactive mode, it already aborts on the second "info exists", with:
malformed bucket chain in Tcl_DeleteHashEntry
Abort

Discussion

    • priority: 5 --> 9
     
  • Reproduced. It seems to be something to do with the unset and cleaning up a stack frame. Maybe also with the variable resolver. :-(

     
  • Fixed on HEAD. Needed to maintain a reference to a namespace variable from the TclOO resolver record, and not just a pointer. Keeping open for port to TclOO-as-package.

     
  • Fixed in TclOO, but not yet pushed to a public fossil repo. (Need one set up on core.tcl.tk...)

     
  • Confirming that all the fixes are where they need to be; just forgot to close this issue.

     
    • status: open --> closed-fixed