Index: generic/xotcl.c =================================================================== diff -u -r58c2c3096136af10d87e4d2962c3d744a9e383bd -r023406d3ec3ce8115b89ae42b0c48c317c63ae0a --- generic/xotcl.c (.../xotcl.c) (revision 58c2c3096136af10d87e4d2962c3d744a9e383bd) +++ generic/xotcl.c (.../xotcl.c) (revision 023406d3ec3ce8115b89ae42b0c48c317c63ae0a) @@ -5296,7 +5296,7 @@ if ((result = InvokeMethod(clientData, interp, objc-1, objv+1, cmd, obj, cl, methodName, frameType)) == TCL_ERROR) { result = XOTclErrInProc(interp, cmdName, - cl ? cl->object.cmdName : NULL, + cl && cl->object.teardown ? cl->object.cmdName : NULL, methodName); } unknown = rst->unknown; Index: generic/xotclStack85.c =================================================================== diff -u -r58c2c3096136af10d87e4d2962c3d744a9e383bd -r023406d3ec3ce8115b89ae42b0c48c317c63ae0a --- generic/xotclStack85.c (.../xotclStack85.c) (revision 58c2c3096136af10d87e4d2962c3d744a9e383bd) +++ generic/xotclStack85.c (.../xotclStack85.c) (revision 023406d3ec3ce8115b89ae42b0c48c317c63ae0a) @@ -300,6 +300,9 @@ XOTCLINLINE static void CallStackPush(XOTclCallStackContent *csc, XOTclObject *obj, XOTclClass *cl, Tcl_Command cmd, int frameType) { obj->activationCount ++; +#if 1 + if (cl) {cl->object.activationCount ++;} +#endif /*fprintf(stderr, "incr activationCount for %s to %d\n", objectName(obj), obj->activationCount);*/ csc->self = obj; csc->cl = cl; @@ -308,7 +311,6 @@ csc->callType = 0; csc->filterStackEntry = frameType == XOTCL_CSC_TYPE_ACTIVE_FILTER ? obj->filterStack : NULL; -#if 0 #if defined(TCL85STACK_TRACE) fprintf(stderr, "PUSH csc %p type %d obj %s, self=%p cmd=%p (%s) id=%p (%s) obj refcount %d name refcount %d\n", csc, frameType, objectName(obj), obj, @@ -317,7 +319,6 @@ obj->id ? Tcl_Command_refCount(obj->id) : -100, obj->cmdName->refCount ); #endif -#endif } XOTCLINLINE static void @@ -333,6 +334,15 @@ if (obj->activationCount < 1 && obj->flags & XOTCL_DESTROY_CALLED) { CallStackDoDestroy(interp, obj); } +#if 1 + if (csc->cl) { + obj = &csc->cl->object; + obj->activationCount --; + if (obj->activationCount < 1 && obj->flags & XOTCL_DESTROY_CALLED) { + CallStackDoDestroy(interp, obj); + } + } +#endif } #endif /* TCL85STACK */