TclOO variable unset problem
Closed / Fixed3185009fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 15 years ago
Descriptionplain2011-02-17 16:52:44
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
dkfplain2011-02-18 06:00:30
Reproduced. It seems to be something to do with the unset and cleaning up a stack frame. Maybe also with the variable resolver. :-(
dkfplain2011-03-05 08:32:29
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.
dkfplain2011-03-11 18:48:36
Fixed in TclOO, but not yet pushed to a public fossil repo. (Need one set up on core.tcl.tk...)
dkfplain2011-09-22 17:48:51
allow_comments - 1 Confirming that all the fixes are where they need to be; just forgot to close this issue.
Log in (anonymous is fine) to add a comment.