Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-09-22
17:48 • Closed ticket [3185009fff]: TclOO variable unset problem plus 7 other change... artifact: 304b61db0b user: dkf
2011-03-11
18:48 • Ticket [3185009fff]: 4 changes artifact: fa014911a9 user: dkf
2011-03-05
08:32 • Ticket [3185009fff]: 4 changes artifact: a2eef80c1e user: dkf
2011-02-18
06:00 • Ticket [3185009fff]: 5 changes artifact: 847f617689 user: dkf
2011-02-17
16:52 • New ticket [3185009fff]. artifact: 586544ada1 user: danckaert

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.