Index: generic/xotcl.c =================================================================== diff -u -rf9807b1cea03590c9573b5a521760538d53ee90f -r5b0ee985a6ff266c1246c8ade3e86c33956ac772 --- generic/xotcl.c (.../xotcl.c) (revision f9807b1cea03590c9573b5a521760538d53ee90f) +++ generic/xotcl.c (.../xotcl.c) (revision 5b0ee985a6ff266c1246c8ade3e86c33956ac772) @@ -217,13 +217,13 @@ if (requiredSize > PARSE_CONTEXT_PREALLOC) { if (pcPtr->objv == &pcPtr->objv_static[1]) { /* realloc from preallocated memory */ - fprintf(stderr, "alloc %d\n", requiredSize); pcPtr->full_objv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj*) * (requiredSize+1)); memcpy(pcPtr->full_objv, &pcPtr->objv_static[0], sizeof(Tcl_Obj*) * PARSE_CONTEXT_PREALLOC); + /*fprintf(stderr, "alloc %d\n", requiredSize);*/ } else { /* realloc from mallocated memory */ pcPtr->full_objv = (Tcl_Obj **)ckrealloc((char *)pcPtr->full_objv, sizeof(Tcl_Obj*) * (requiredSize)); - fprintf(stderr, "realloc %d\n", requiredSize); + /*fprintf(stderr, "realloc %d\n", requiredSize);*/ } pcPtr->objv = &pcPtr->full_objv[1]; } @@ -5499,7 +5499,6 @@ XOTclCallStackContent *cscPtr) { CheckOptions co; int result; - XOTclRuntimeState *rst = RUNTIME_STATE(interp); #if defined(TCL85STACK) XOTcl_FrameDecls; #endif @@ -5539,9 +5538,8 @@ printCall(interp, "CmdMethodDispatch cmd", objc, objv); fprintf(stderr, "\tcmd=%s\n", Tcl_GetCommandName(interp, cmdPtr)); #endif - rst->deallocCalled = 0; - /*fprintf(stderr, "CmdDispatch obj %p %p %s\n", obj, methodName, methodName);*/ + /*fprintf(stderr, "CmdDispatch obj %p %p %s\n", obj, methodName, methodName);*/ #if !defined(NRE) result = (*Tcl_Command_objProc(cmdPtr))(cp, interp, objc, objv); #else @@ -5557,12 +5555,9 @@ } #endif - /*fprintf(stderr, "CmdDispatch obj %p %p deallocCalled %d\n", - obj, methodName, rst->deallocCalled);*/ - - /* The order of the if-condition below is important, since obj might be already - freed in case the call was a "dealloc" */ - if (!rst->deallocCalled && obj->opt) { + /* Reference counting in the calling ObjectDispatch() makes sure + that obj->opt is still accessible even after "dealloc" */ + if (obj->opt) { co = obj->opt->checkoptions; if ((co & CHECK_INVAR) && ((result = AssertionCheckInvars(interp, obj, methodName, co)) == TCL_ERROR)) { @@ -12405,10 +12400,7 @@ static int XOTclCDeallocMethod(Tcl_Interp *interp, XOTclClass *cl, Tcl_Obj *obj) { XOTclObject *delobject; - XOTclRuntimeState *rst = RUNTIME_STATE(interp); - rst->deallocCalled = 1; - /*fprintf(stderr, "XOTclCDeallocMethod obj %p %s\n",obj, ObjStr(obj));*/ if (GetObjectFromObj(interp, obj, &delobject) != TCL_OK) { Index: generic/xotclInt.h =================================================================== diff -u -rf3cbadd6d76459cc00032877fa905bb618e9f780 -r5b0ee985a6ff266c1246c8ade3e86c33956ac772 --- generic/xotclInt.h (.../xotclInt.h) (revision f3cbadd6d76459cc00032877fa905bb618e9f780) +++ generic/xotclInt.h (.../xotclInt.h) (revision 5b0ee985a6ff266c1246c8ade3e86c33956ac772) @@ -665,7 +665,6 @@ int cacheInterface; int exitHandlerDestroyRound; int returnCode; - int deallocCalled; long newCounter; XOTclStringIncrStruct iss; Proc fakeProc; Index: generic/xotclStack85.c =================================================================== diff -u -re2bce71b86e234dd095039949f8e7dbbb4a4620e -r5b0ee985a6ff266c1246c8ade3e86c33956ac772 --- generic/xotclStack85.c (.../xotclStack85.c) (revision e2bce71b86e234dd095039949f8e7dbbb4a4620e) +++ generic/xotclStack85.c (.../xotclStack85.c) (revision 5b0ee985a6ff266c1246c8ade3e86c33956ac772) @@ -363,8 +363,6 @@ obj, objectName(obj), obj->activationCount, obj->flags, csc->cl->nsPtr, csc->cmdPtr, ((Command *)csc->cmdPtr)->nsPtr); */ - /*fprintf(stderr, "dealloc called %d\n",rst->deallocCalled);*/ - /*fprintf(stderr, "CallStackPop check ac %d flags %.6x\n", obj->activationCount, obj->flags & XOTCL_DESTROY_CALLED);*/ Index: tests/testx.xotcl =================================================================== diff -u -rf9807b1cea03590c9573b5a521760538d53ee90f -r5b0ee985a6ff266c1246c8ade3e86c33956ac772 --- tests/testx.xotcl (.../testx.xotcl) (revision f9807b1cea03590c9573b5a521760538d53ee90f) +++ tests/testx.xotcl (.../testx.xotcl) (revision 5b0ee985a6ff266c1246c8ade3e86c33956ac772) @@ -1737,10 +1737,6 @@ a0 proc f3 {} {puts hu} a0 forward f4 puts hu - puts stderr "### [Object self] info commands parametercmd => [Object info commands parametercmd]" - puts stderr a0->[a0 info class]-[A info class]-[::xotcl::Class info class]-[a0 info methods *parameter*] - puts stderr "### heritage: [a0 info precedence]" - a0 parametercmd f6 ::errorCheck [a0 procsearch f1] "::A instproc f1" procsearch-1