summaryrefslogtreecommitdiffstats
path: root/generic/tclOODefineCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclOODefineCmds.c')
-rw-r--r--generic/tclOODefineCmds.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 7c2a641..6c1d58a 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -1185,15 +1185,13 @@ TclOODefineClassObjCmd(
*/
if (oPtr->selfCls != clsPtr) {
- TclOORemoveFromInstances(oPtr, oPtr->selfCls);
-
- /*
- * Reference count already incremented a few lines up.
- */
+ TclOORemoveFromInstances(oPtr, oPtr->selfCls);
+ TclOODecrRefCount(oPtr->selfCls->thisPtr);
oPtr->selfCls = clsPtr;
-
+ AddRef(oPtr->selfCls->thisPtr);
TclOOAddToInstances(oPtr, oPtr->selfCls);
+
if (oPtr->classPtr != NULL) {
BumpGlobalEpoch(interp, oPtr->classPtr);
} else {
@@ -2234,11 +2232,6 @@ ClassSuperSet(
superclasses[0] = oPtr->fPtr->objectCls;
}
superc = 1;
-
- /*
- * Corresponding TclOODecrRefCount is near the end of this function.
- */
-
AddRef(superclasses[0]->thisPtr);
} else {
for (i=0 ; i<superc ; i++) {
@@ -2295,12 +2288,6 @@ ClassSuperSet(
oPtr->classPtr->superclasses.num = superc;
FOREACH(superPtr, oPtr->classPtr->superclasses) {
TclOOAddToSubclasses(oPtr->classPtr, superPtr);
-
- /*
- * To account for the AddRef() earlier in this function.
- */
-
- TclOODecrRefCount(superPtr->thisPtr);
}
BumpGlobalEpoch(interp, oPtr->classPtr);