Index: generic/nsf.c =================================================================== diff -u -r736930e9bcae64c47aa54a49cbd15d0fa60e46c4 -r9fafad1fd703c9ee24aa9b32d820c313853bf2b5 --- generic/nsf.c (.../nsf.c) (revision 736930e9bcae64c47aa54a49cbd15d0fa60e46c4) +++ generic/nsf.c (.../nsf.c) (revision 9fafad1fd703c9ee24aa9b32d820c313853bf2b5) @@ -255,7 +255,6 @@ static void PrimitiveCDestroy(ClientData clientData) nonnull(1); static void PrimitiveODestroy(ClientData clientData) nonnull(1); static void PrimitiveDestroy(ClientData clientData) nonnull(1); -static void NsfCleanupObject_(NsfObject *object) nonnull(1); /* prototypes for object and command lookup */ static NsfObject *GetObjectFromString(Tcl_Interp *interp, CONST char *name) @@ -1488,7 +1487,7 @@ * *---------------------------------------------------------------------- */ -static void +void NsfCleanupObject_(NsfObject *object) { assert(object); Index: generic/nsfDebug.c =================================================================== diff -u -r6a4551cfa20c7ea0169bdf8f98896b36768e652b -r9fafad1fd703c9ee24aa9b32d820c313853bf2b5 --- generic/nsfDebug.c (.../nsfDebug.c) (revision 6a4551cfa20c7ea0169bdf8f98896b36768e652b) +++ generic/nsfDebug.c (.../nsfDebug.c) (revision 9fafad1fd703c9ee24aa9b32d820c313853bf2b5) @@ -289,7 +289,7 @@ assert(id); if (!*tableInitialized) { - fprintf(stderr, "+++ free %s %p\n", id, p); + fprintf(stderr, "+++ free %s %p !tableInitialized !\n", id, p); return; } #ifdef NSF_MEM_TRACE Index: generic/nsfInt.h =================================================================== diff -u -rc80d4916d7ceaf155f661ad5d7cd9c5b10696276 -r9fafad1fd703c9ee24aa9b32d820c313853bf2b5 --- generic/nsfInt.h (.../nsfInt.h) (revision c80d4916d7ceaf155f661ad5d7cd9c5b10696276) +++ generic/nsfInt.h (.../nsfInt.h) (revision 9fafad1fd703c9ee24aa9b32d820c313853bf2b5) @@ -908,6 +908,8 @@ /* * NsfObject Reference Accounting */ +EXTERN void NsfCleanupObject_(NsfObject *object) nonnull(1); + #if defined(NSFOBJ_TRACE) # define NsfObjectRefCountIncr(obj) \ ((NsfObject *)obj)->refCount++; \ Index: generic/nsfObj.c =================================================================== diff -u -r4344f09a497442a67dd503dcdce348a376491749 -r9fafad1fd703c9ee24aa9b32d820c313853bf2b5 --- generic/nsfObj.c (.../nsfObj.c) (revision 4344f09a497442a67dd503dcdce348a376491749) +++ generic/nsfObj.c (.../nsfObj.c) (revision 9fafad1fd703c9ee24aa9b32d820c313853bf2b5) @@ -351,12 +351,14 @@ Mixinreg *mixinRegPtr = (Mixinreg *)objPtr->internalRep.twoPtrValue.ptr1; assert(mixinRegPtr); - /*fprintf(stderr, "MixinregFreeInternalRep freeing mixinReg %p class %p guard %p\n", - mixinRegPtr, mixinRegPtr->class, mixinRegPtr->guardObj);*/ + /*fprintf(stderr, "MixinregFreeInternalRep freeing mixinReg %p class %p guard %p refcount before decr %d\n", + mixinRegPtr, mixinRegPtr->mixin, mixinRegPtr->guardObj, (&(mixinRegPtr->mixin)->object)->refCount);*/ + /* * Decrement refCounts */ - NsfObjectRefCountDecr(&(mixinRegPtr->mixin)->object); + NsfCleanupObject(&(mixinRegPtr->mixin)->object, "MixinregFreeInternalRep"); + if (mixinRegPtr->guardObj) {DECR_REF_COUNT2("mixinRegPtr->guardObj", mixinRegPtr->guardObj);} /* @@ -453,8 +455,8 @@ NsfObjectRefCountIncr((&mixin->object)); if (guardObj) {INCR_REF_COUNT2("mixinRegPtr->guardObj", guardObj);} - /*fprintf(stderr, "MixinregSetFromAny alloc mixinReg %p class %p guard %p\n", - mixinRegPtr, mixinRegPtr->mixin, mixinRegPtr->guardObj);*/ + /*fprintf(stderr, "MixinregSetFromAny alloc mixinReg %p class %p guard %p object->refCount %d\n", + mixinRegPtr, mixinRegPtr->mixin, mixinRegPtr->guardObj, ((&mixin->object)->refCount));*/ /* * Free the old interal representation and store own structure as internal