summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authormig <mig>2011-04-11 10:37:39 (GMT)
committermig <mig>2011-04-11 10:37:39 (GMT)
commit084e0e3592fe3bef1db12395401090e9d317c590 (patch)
tree1f3e4c52bddeb57ff9a613cd7cbe551508c36206 /generic/tclBasic.c
parentef309fcd9588574626469b6b0d0e169dbf0e097c (diff)
downloadtcl-084e0e3592fe3bef1db12395401090e9d317c590.zip
tcl-084e0e3592fe3bef1db12395401090e9d317c590.tar.gz
tcl-084e0e3592fe3bef1db12395401090e9d317c590.tar.bz2
insure that 'coroutine eval' runs the initial command in the proper context, [Bug 3282869]
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index f00864f..5019c86 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -8866,6 +8866,7 @@ TclNRCoroutineObjCmd(
const char *fullName, *procName;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
Tcl_DString ds;
+ Namespace *lookupNsPtr = iPtr->varFramePtr->nsPtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "name cmd ?arg ...?");
@@ -8952,7 +8953,7 @@ TclNRCoroutineObjCmd(
}
/*
- * Save the base context.
+ * Create the base context.
*/
corPtr->running.framePtr = iPtr->rootFramePtr;
@@ -8972,13 +8973,19 @@ TclNRCoroutineObjCmd(
corPtr->callerEEPtr = iPtr->execEnvPtr;
corPtr->eePtr->corPtr = corPtr;
+ SAVE_CONTEXT(corPtr->caller);
+ corPtr->callerEEPtr = iPtr->execEnvPtr;
+ RESTORE_CONTEXT(corPtr->running);
iPtr->execEnvPtr = corPtr->eePtr;
TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr,
NULL, NULL, NULL);
- iPtr->lookupNsPtr = iPtr->varFramePtr->nsPtr;
+ iPtr->lookupNsPtr = lookupNsPtr;
Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0);
+
+ SAVE_CONTEXT(corPtr->running);
+ RESTORE_CONTEXT(corPtr->caller);
iPtr->execEnvPtr = corPtr->callerEEPtr;
/*