diff options
author | sebres <sebres@users.sourceforge.net> | 2017-04-04 11:13:36 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-04-04 11:13:36 (GMT) |
commit | a61a0e3df9df21ead49108d82842a48617cb0c09 (patch) | |
tree | e66a97c3efde500285a7899640d135a918b8612e /generic | |
parent | 3637b82062f2363b7f70d0edca031396b2939efb (diff) | |
download | tcl-fix_42202ba1e5ff566e.zip tcl-fix_42202ba1e5ff566e.tar.gz tcl-fix_42202ba1e5ff566e.tar.bz2 |
bug fix for [42202ba1e5ff566e0f9abb9f890e460fbc6c1c5c]: segfault by coro injectfix_42202ba1e5ff566e
rewritten callback for ::tcl::unsupported::inject, without leave the interpreter in unusable state (inaccurate environment exchange by adding eval callback), test covered now.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4bddbce..f604ac1 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8748,6 +8748,35 @@ TclNRCoroutineActivateCallback( /* *---------------------------------------------------------------------- * + * TclNREvalList -- + * + * Callback to invoke command as list, used in order to delayed + * processing of canonical list command in sane environment. + * + *---------------------------------------------------------------------- + */ + +static int +TclNREvalList( + ClientData data[], + Tcl_Interp *interp, + int result) +{ + int objc; + Tcl_Obj **objv; + Tcl_Obj *listPtr = data[0]; + + Tcl_IncrRefCount(listPtr); + + TclMarkTailcall(interp); + TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL); + TclListObjGetElements(NULL, listPtr, &objc, &objv); + return TclNREvalObjv(interp, objc, objv, 0, NULL); +} + +/* + *---------------------------------------------------------------------- + * * NRCoroInjectObjCmd -- * * Implementation of [::tcl::unsupported::inject] command. @@ -8799,7 +8828,8 @@ NRCoroInjectObjCmd( */ iPtr->execEnvPtr = corPtr->eePtr; - TclNREvalObjEx(interp, Tcl_NewListObj(objc-2, objv+2), 0, NULL, INT_MIN); + TclNRAddCallback(interp, TclNREvalList, Tcl_NewListObj(objc-2, objv+2), + NULL, NULL, NULL); iPtr->execEnvPtr = savedEEPtr; return TCL_OK; |