Artifacts Associated With Ticket 6d4319309e906144
Ticket change [6a170d507b] (rid 237530) by anonymous on 2025-02-12 22:37:45:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
When a class is defined in a namespace and it inherits from a class with the same name from a different namespace and an object from the child class is destroyed, the destructor from the parent class does not get invoked.
- foundin initialized to: "Itcl 4.3.2"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "8a2f9364d2100f10600b2a3fdde9d6d6881f15fa"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "10. Objects"
- title initialized to:
Parent-Class destructor not invoked with same class-name in different namespace
- type initialized to: "Bug"
Add attachment "namespace-class-destructor.tcl" [5bd5390c67] (rid 237531) by anonymous on 2025-02-12 22:40:03.
Ticket change [406af42c23] (rid 237532) by sebres on 2025-02-13 22:06:57:
- icomment:
It seems to be solely Itcl (v.4) issue (thus the correct place for the ticket would be [itcl/ticket](/../itcl/ticket)). Below enclosed the PoC for tclOO (basis of Itcl since Itcl4), that works as expected: <details style="padding-left:10pt"><summary>PoC ...</summary> ``` namespace eval ::A {}; namespace eval ::B {} oo::class create ::A::testCls { superclass oo::class destructor { puts "bye from ::A::testCls" } } oo::class create ::C::testOtherCls { superclass ::A::testCls destructor { puts "bye from ::C::testOtherCls"; next } } oo::class create ::C::testCls { superclass ::A::testCls destructor { puts "bye from ::C::testCls"; next } } set o [::C::testOtherCls new] $o destroy puts ================= set o [::C::testCls new] $o destroy ## results to: bye from ::C::testOtherCls bye from ::A::testCls ================= bye from ::C::testCls bye from ::A::testCls ``` </details> Although in tclOO inherited destructor need to be invoked explicitly (using `next`). I guess, Itcl stores somewhere (hash table?) the chain of destructors by simple name (instead of its reference or fully-qualified name). - login: "sebres"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [0bc0d86c30] (rid 237618) by sebres on 2025-02-20 13:04:29:
- closedate changed to: "2460727.04478788"
- closer changed to: "sebres"
- icomment:
Yes, my suspicion about simple name in hash table has been confirmed...<br/> Fixed in [[itcl/883c2c383fee7603]](../itcl/vdiff?from=0d99fec557eac487&to=883c2c383fee7603), related ticket [[itcl/987067386fa2edae]](../itcl/info/987067386fa2edae).
- login: "sebres"
- mimetype: "text/x-markdown"
- resolution changed to: "Fixed"
- status changed to: "Closed"