2025-02-20
| ||
13:23 | amend to [987067386fa2edae]: adding coverage for constructor too (just to ensure we don't fall into the same trap by constructors) check-in: eb467f0c52 user: sebres tags: trunk, main | |
12:59 | • Closed ticket [987067386f]: Parent-Class destructor not invoked with same class-name in different namespace plus 5 other changes artifact: fe845feaf2 user: sebres | |
12:56 | fixes [987067386fa2edae] don't use name of class in destructed hash, so ensure NS::C inheriting C would invoke destructor of base class (if both have destructors and clases have the same name) check-in: 883c2c383f user: sebres tags: trunk, main | |
12:54 | add test illustrating bug [987067386fa2edae]: NS::C inheriting C would not invoke destructor of base class (if both have destructors and clases have the same name) check-in: df20905f77 user: sebres tags: trunk, main | |
2025-02-18
| ||
12:40 | • Ticket [987067386f] Parent-Class destructor not invoked with same class-name in different namespace status still Open with 5 other changes artifact: 7d0fd20632 user: anonymous | |
12:37 | • Add attachment namespace-class-destructor.tcl to ticket [987067386f] artifact: 3ca71fea62 user: anonymous | |
12:37 | • New ticket [987067386f] Parent-Class destructor not invoked with same class-name in different namespace. artifact: 5570b6a268 user: anonymous | |
Ticket Hash: | 987067386fa2edae90f13c464c5081c3881fd0ae | ||
Title: | Parent-Class destructor not invoked with same class-name in different namespace | ||
Status: | Closed | Type: | Code_Defect |
Severity: | Important | Priority: | Immediate |
Subsystem: | Resolution: | Fixed | |
Last Modified: |
2025-02-20 12:59:35 136.9 days ago |
Created: |
2025-02-18 12:37:08 138.9 days ago |
Version Found In: | 4.3.2 |
User Comments: | ||||
anonymous added on 2025-02-18 12:37:08:
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. anonymous added on 2025-02-18 12:40:18: Previously submitted as https://core.tcl-lang.org/tcl/tktview/6d4319309e906144741e PoC ... 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 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). sebres added on 2025-02-20 12:59:35:
Yes, my suspicion about simple name in hash table has been confirmed... |
Attachments:
- namespace-class-destructor.tcl [download] added by anonymous on 2025-02-18 12:37:53. [details]