|
2017-11-18
| ||
| 00:14 | • Ticket [3c32a3f8bd] TclOO - mixing an object status still Closed with 4 othe... artifact: dd1f4e80ca user: pooryorick | |
|
2017-11-17
| ||
| 23:06 | • Closed ticket [3c32a3f8bd]. artifact: 43d1bf64af user: pooryorick | |
|
2017-11-01
| ||
| 20:57 | • Ticket [3c32a3f8bd]: 3 changes artifact: d69854ed4b user: pooryorick | |
| 20:48 | • New ticket [3c32a3f8bd]. artifact: 37b03fcd24 user: pooryorick | |
TclOO - mixing an object
proc dying {_ args} {
puts [list $_ is dying]
}
oo::define oo::class {export createWithNamespace}
oo::class createWithNamespace obj1 obj1
::oo::define obj1 {self mixin [self]}
::oo::copy obj1 obj2
::oo::objdefine obj2 {mixin [self]}
::oo::copy obj2 obj3
trace add command obj3 delete [list obj3 dying]
rename obj2 {}
The problem lies in TclOO.c/ReleaseClassContents(), in a section that seems to be about removing a class that has been mixed into one of its instances (an unusual use case, to say the least):
for(j=0 ; j<instancePtr->mixins.num ; j++) {
Class *mixin = instancePtr->mixins.list[j];
if (mixin == clsPtr) {
instancePtr->mixins.list[j] = NULL;
}
}
Leaving a NULL in the list breaks expectations. Instead, that
particular item should be unstitched from the list.
Fixed in commit [5f178e7f03].