diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclOO.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index 4697054..9df5029 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -898,10 +898,10 @@ ObjectRenamedTrace( /* * ---------------------------------------------------------------------- * - * ReleaseClassContents -- + * ClearMixins, ClearSuperclasses -- * - * Tear down the special class data structure, including deleting all - * dependent classes and objects. + * Utility functions for correctly clearing the list of mixins or + * superclasses of a class. Will ckfree() the list storage. * * ---------------------------------------------------------------------- */ @@ -921,6 +921,7 @@ ClearMixins( TclOORemoveFromMixinSubs(clsPtr, mixinPtr); } ckfree(clsPtr->mixins.list); + clsPtr->mixins.list = NULL; clsPtr->mixins.num = 0; } @@ -939,8 +940,20 @@ ClearSuperclasses( TclOORemoveFromSubclasses(clsPtr, superPtr); } ckfree(clsPtr->superclasses.list); + clsPtr->superclasses.list = NULL; clsPtr->superclasses.num = 0; } + +/* + * ---------------------------------------------------------------------- + * + * ReleaseClassContents -- + * + * Tear down the special class data structure, including deleting all + * dependent classes and objects. + * + * ---------------------------------------------------------------------- + */ static void ReleaseClassContents( @@ -1231,6 +1244,10 @@ ObjectNamespaceDeleted( oPtr->metadataPtr = NULL; } + /* + * If this was a class, there's additional deletion work to do. + */ + if (clsPtr != NULL) { Tcl_ObjectMetadataType *metadataTypePtr; ClientData value; |