summaryrefslogtreecommitdiffstats
path: root/generic/tclOO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-12-22 19:50:04 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-12-22 19:50:04 (GMT)
commit2516cd875a00dd9b9f1d23f43a86342c1007bdb4 (patch)
tree6fe976dda1efa57c1d8bee8150a2c4c73a53bc66 /generic/tclOO.c
parent1614457e38312b8180cd9ef843bffcc6a45a14cc (diff)
downloadtcl-2516cd875a00dd9b9f1d23f43a86342c1007bdb4.zip
tcl-2516cd875a00dd9b9f1d23f43a86342c1007bdb4.tar.gz
tcl-2516cd875a00dd9b9f1d23f43a86342c1007bdb4.tar.bz2
[593baa032c] Additional fix for the mixinSubs list.
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r--generic/tclOO.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index f2e0ca9..34eb5ad 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -58,6 +58,7 @@ static const struct {
static Class * AllocClass(Tcl_Interp *interp, Object *useThisObj);
static Object * AllocObject(Tcl_Interp *interp, const char *nameStr,
const char *nsNameStr);
+static void ClearMixins(Class *clsPtr);
static void ClearSuperclasses(Class *clsPtr);
static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr,
Method *mPtr, Tcl_Obj *namePtr,
@@ -906,6 +907,20 @@ ObjectRenamedTrace(
*/
static void
+ClearMixins(
+ Class *clsPtr)
+{
+ int i;
+ Class *mixinPtr;
+
+ FOREACH(mixinPtr, clsPtr->mixins) {
+ TclOORemoveFromMixinSubs(clsPtr, mixinPtr);
+ }
+ ckfree(clsPtr->mixins.list);
+ clsPtr->mixins.num = 0;
+}
+
+static void
ClearSuperclasses(
Class *clsPtr)
{
@@ -994,6 +1009,9 @@ ReleaseClassContents(
Tcl_DeleteCommandFromToken(interp,
mixinSubclassPtr->thisPtr->command);
}
+ if (mixinSubclassPtr->mixins.num) {
+ ClearMixins(mixinSubclassPtr);
+ }
DelRef(mixinSubclassPtr->thisPtr);
DelRef(mixinSubclassPtr);
}
@@ -1232,14 +1250,9 @@ ObjectNamespaceDeleted(
ckfree(clsPtr->filters.list);
clsPtr->filters.num = 0;
}
- FOREACH(mixinPtr, clsPtr->mixins) {
- if (!Deleted(mixinPtr->thisPtr)) {
- TclOORemoveFromMixinSubs(clsPtr, mixinPtr);
- }
- }
- if (i) {
- ckfree(clsPtr->mixins.list);
- clsPtr->mixins.num = 0;
+
+ if (clsPtr->mixins.num) {
+ ClearMixins(clsPtr);
}
if (clsPtr->superclasses.num) {
ClearSuperclasses(clsPtr);