From aeeead96a33d9d54f77f6beaa6e10b1bd2a8dd4f Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Wed, 17 Sep 2008 00:01:44 +0000 Subject: * generic/tclBasic.c: move TclResetCancellation to be called on returning to level 0, as opposed to it being called on starting a command at level 0. Add a call on returning via Tcl_EvalObjEx to fix [Bug 2114165]. --- ChangeLog | 7 +++++++ generic/tclBasic.c | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99362ba..b228166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-09-16 Miguel Sofer + + * generic/tclBasic.c: move TclResetCancellation to be called on + returning to level 0, as opposed to it being called on starting a + command at level 0. Add a call on returning via Tcl_EvalObjEx to + fix [Bug 2114165]. + 2008-09-10 Donal K. Fellows * doc/binary.n: Added partial documentation of [binary encode] and diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1f80d43..42cac49 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.366 2008/09/10 13:24:00 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.367 2008/09/17 00:01:48 msofer Exp $ */ #include "tclInt.h" @@ -4033,7 +4033,6 @@ TclNREvalObjv( TclNRAddCallback(interp, NRCommand, NULL, NULL, NULL, NULL); cmdPtrPtr = (Command **) &(TOP_CB(interp)->data[0]); - TclResetCancellation(interp, 0); iPtr->numLevels++; result = TclInterpReady(interp); @@ -4411,6 +4410,14 @@ TEOV_Exception( result = TCL_ERROR; } } + + /* + * We are returning to level 0, so should process TclResetCancellation. As + * numLevels has not *yet* been decreased, do not call it: do the thing + * here directly. + */ + + iPtr->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)); return result; } @@ -5924,6 +5931,13 @@ TEOEx_ByteCodeCallback( script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); Tcl_LogCommandInfo(interp, script, script, numSrcBytes); } + + /* + * We are returning to level 0, so should call TclResetCancellation. + * Let us just unset the flags inline. + */ + + iPtr->flags &= (~(CANCELED | TCL_CANCEL_UNWIND)); } iPtr->evalFlags = 0; -- cgit v0.12