summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-08-07 04:13:49 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-08-07 04:13:49 (GMT)
commit62d36886b926591b14c230558c64c8ccc85cbb82 (patch)
tree26cfbd7a3f089a2bb3f53d5644eede7418f4f529 /generic/tclBasic.c
parent4c3c492b67b48506cdf77c1f146af9f4318f24c1 (diff)
downloadtcl-62d36886b926591b14c230558c64c8ccc85cbb82.zip
tcl-62d36886b926591b14c230558c64c8ccc85cbb82.tar.gz
tcl-62d36886b926591b14c230558c64c8ccc85cbb82.tar.bz2
* generic/tclBasic.c: Fix tailcalls falling out of tebc into
* generic/tclExecute.c: Tcl_EvalEx [Bug 2017946] * generic/tclInt.h:
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 4a4c240..1133c4c 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.350 2008/08/04 14:09:28 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.351 2008/08/07 04:13:50 msofer Exp $
*/
#include "tclInt.h"
@@ -691,7 +691,8 @@ Tcl_CreateInterp(void)
#endif
iPtr->pendingObjDataPtr = NULL;
iPtr->asyncReadyPtr = TclGetAsyncReadyPtr();
-
+ iPtr->atExitPtr = NULL;
+
/*
* Create the core commands. Do it here, rather than calling
* Tcl_CreateCommand, because it's faster (there's no need to check for a
@@ -4169,6 +4170,7 @@ TclNRRunCallbacks(
(void) Tcl_GetObjResult(interp);
}
+ restart:
while (TOP_CB(interp) != rootPtr) {
callbackPtr = TOP_CB(interp);
procPtr = callbackPtr->procPtr;
@@ -4191,6 +4193,16 @@ TclNRRunCallbacks(
result = (procPtr)(callbackPtr->data, interp, result);
TCLNR_FREE(interp, callbackPtr);
}
+ if (iPtr->atExitPtr) {
+ callbackPtr = iPtr->atExitPtr;
+ while (callbackPtr->nextPtr) {
+ callbackPtr = callbackPtr->nextPtr;
+ }
+ callbackPtr->nextPtr = rootPtr;
+ TOP_CB(iPtr) = iPtr->atExitPtr;
+ iPtr->atExitPtr = NULL;
+ goto restart;
+ }
return result;
}