summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclOO.c9
-rw-r--r--generic/tclOODefineCmds.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 440f8e4..c87d7bb 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -1057,7 +1057,6 @@ TclOOReleaseClassContents(
if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) {
Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command);
}
- oPtr->classPtr = NULL;
}
/*
@@ -1183,7 +1182,9 @@ ObjectNamespaceDeleted(
TclOORemoveFromInstances(oPtr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- Tcl_Free(oPtr->mixins.list);
+ if (oPtr->mixins.list != NULL) {
+ Tcl_Free(oPtr->mixins.list);
+ }
}
FOREACH(filterObj, oPtr->filters) {
@@ -1384,6 +1385,10 @@ TclOORemoveFromMixins(
break;
}
}
+ if (oPtr->mixins.num == 0) {
+ Tcl_Free(oPtr->mixins.list);
+ oPtr->mixins.list = NULL;
+ }
return res;
}
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 9d23f8f..3f8d2d6 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -1449,6 +1449,8 @@ TclOODefineClassObjCmd(
TclOODeleteDescendants(interp, oPtr);
oPtr->flags &= ~DONT_DELETE;
TclOOReleaseClassContents(interp, oPtr);
+ Tcl_Free(oPtr->classPtr);
+ oPtr->classPtr = NULL;
} else if (!wasClass && willBeClass) {
TclOOAllocClass(interp, oPtr);
}