diff options
author | pooryorick <com.digitalsmarties@pooryorick.com> | 2017-11-01 21:05:32 (GMT) |
---|---|---|
committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2017-11-01 21:05:32 (GMT) |
commit | 8bb421f959a1a5cb8a552a423341b4a7896b042c (patch) | |
tree | cc7ecb7615fda9777f9fcf95f93de9826c5073a3 /generic/tclOO.c | |
parent | e0578530b062a38b3fe7dfd1474dd3caa927c271 (diff) | |
download | tcl-8bb421f959a1a5cb8a552a423341b4a7896b042c.zip tcl-8bb421f959a1a5cb8a552a423341b4a7896b042c.tar.gz tcl-8bb421f959a1a5cb8a552a423341b4a7896b042c.tar.bz2 |
Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents()
for a class mixed into one of its instances.
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index e9ef2ce..51731d3 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1006,8 +1006,18 @@ ReleaseClassContents( } for(j=0 ; j<instancePtr->mixins.num ; j++) { Class *mixin = instancePtr->mixins.list[j]; + Class *nextMixin = NULL; if (mixin == clsPtr) { - instancePtr->mixins.list[j] = NULL; + if (j < instancePtr->mixins.num - 1) { + nextMixin = instancePtr->mixins.list[j+1]; + } + if (j == 0) { + instancePtr->mixins.num = 0; + instancePtr->mixins.list = NULL; + } else { + instancePtr->mixins.list[j-1] = nextMixin; + } + instancePtr->mixins.num -= 1; } } if (instancePtr != NULL && !IsRoot(instancePtr)) { @@ -1181,7 +1191,8 @@ ObjectNamespaceDeleted( if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { /* * Namespace deletion must have been triggered by a trace on command - * deletion , meaning that + * deletion , meaning that ObjectRenamedTrace() is eventually going + * to be called . */ deleteAlreadyInProgress = 1; } |