Index: generic/xotcl.c =================================================================== diff -u -rcedbcd6a70c433f37525ad01e254895b600db08b -r018ced50b0b8139c67310d99f9541e933b7a1f2d --- generic/xotcl.c (.../xotcl.c) (revision cedbcd6a70c433f37525ad01e254895b600db08b) +++ generic/xotcl.c (.../xotcl.c) (revision 018ced50b0b8139c67310d99f9541e933b7a1f2d) @@ -2222,18 +2222,21 @@ XOTclCallStackFindLastInvocation(Tcl_Interp *interp, int offset) { XOTclCallStack *cs = &RUNTIME_STATE(interp)->cs; register XOTclCallStackContent *csc = cs->top; - int topLevel = csc->currentFramePtr ? Tcl_CallFrame_level(csc->currentFramePtr) :0; + int topLevel = csc->currentFramePtr ? Tcl_CallFrame_level(csc->currentFramePtr) : 0; int deeper = offset; /* skip through toplevel inactive filters, do this offset times */ for (csc=cs->top; csc > cs->content; csc--) { + /* fprintf(stderr, "csc %p callType = %x, frameType = %x, offset=%d\n", + csc,csc->callType,csc->frameType,offset); */ if ((csc->callType & XOTCL_CSC_CALL_IS_NEXT) || (csc->frameType & XOTCL_CSC_TYPE_INACTIVE)) continue; if (offset) offset--; else { - if (!deeper) { + /* fprintf(stderr, "csc %p offset ok, deeper=%d\n",csc,deeper); */ + if (!deeper || cs->top->callType & XOTCL_CSC_CALL_IS_GUARD) { return csc; } if (csc->currentFramePtr && Tcl_CallFrame_level(csc->currentFramePtr) < topLevel) { @@ -2242,6 +2245,7 @@ } } /* for some reasons, we could not find invocation (topLevel, destroy) */ + /* fprintf(stderr, "csc %p could not find invocation\n",csc);*/ return NULL; } @@ -3809,9 +3813,12 @@ int rc = TCL_OK; if (clientData) { + XOTclCallStackContent *csc = CallStackGetTopFrame(interp); Tcl_Obj *res = Tcl_GetObjResult(interp); /* save the result */ INCR_REF_COUNT(res); + csc->callType |= XOTCL_CSC_CALL_IS_GUARD; + /* GuardPrint(interp, cmdList->clientData); */ /* * ok, there is a guard ... we have to push a