<i>TCL_RETURN causes TclUpdateReturnInfo() to panic</i> status still Open with 4 other changes
by
.
D 2008-10-20T01:52:36
J icomment \nThe\serror\shere\sis\sin\sthe\sevaluation\nof\s[cproc\s1].\s\sWith\sa\ssingle\sargument\nthe\sbranch\sis\staken\sthat\sevaluates\n[tclproc].\s\sIf\syou\sexamine\sthe\sreturn\ncode\sfrom\sthat\sTcl_Eval(),\syou\swill\nfind\sthat\sit\sis\sTCL_OK.\s\sThe\scommand\n[tclproc]\shas\srun\ssuccessfully.\n\nYou\sthen\sturn\saround\sand\soriginate\sa\nTCL_RETURN\sreturn\scode,\swithout\ndealing\swith\sthe\sfact\sthat\san\nintervening\sTcl_Eval()\shas\staken\nthe\sinterp\sout\sof\sthe\sreset\sstate\nit\shad\swhen\sit\sentered\sCProcCmd.\n\nThere\sare\sa\snumber\sof\sways\sto\nfix\sthe\scode,\sdepending\son\sjust\nwhat\sit\sis\sthis\scode\sis\sintended\nto\sdo.\s\sThat\sis\snot\sclear\sat\sall\nfrom\sthe\sexample,\swhich\sfeels\s\ncontrived\sto\sdemo\sthe\sconditions\nfor\spanic,\smore\sthan\sdirected\ntoward\sany\srational\spurpose.\s\sThat's\nfine;\sthat's\soften\strue\sof\sbug\ndemos,\sbut\sleaves\sme\swithout\sany\ncontext\sto\schoose\swhat\salternative\nmight\smake\ssense.\n\nIf\syou\shave\sa\sTcl_ObjCmdProc\sthat\nwill\sreturn\sTCL_RETURN,\syou\sshould\neither\sdo\sthat\swith\sthe\sinterp\nstill\sin\sits\soriginal\sreset\sstate,\nor\sdo\sthat\safter\ssomething\syou\scalled\nalso\sreturned\sTCL_RETURN\s(the\s"pass\nalong\sthe\sexception"\scase),\sor\stake\ncare\sto\scall\sTcl_SetReturnOptions()\nto\sset\sthe\srelevant\soptions\sas\sneeded\nfor\syour\scommand\s(the\s"I'm\soriginating\nTCL_RETURN\sfor\smy\sown\spurposes"\scase).\n\nIt\sseems\sto\sme\sthe\spanic\sis\sserving\nexactly\sthe\spurpose\sintended,\sto\scall\nattention\sto\sC\scode\sthat's\snot\srobust\nor\ssafe\sso\sit\scan\sget\scorrected.\n\nNote\sthat\syour\sworkarounds\sare\sjust\ntricky\sindirect\sways\sto\stake\smy\sadvice.\nExplicit\sreturnLevel\sincrement\sis\sjust\na\ssneaky\s"probe\sthe\sinternals"\sway\sto\naccomplish\swhat\sa\sproper\sTcl_SetReturnOptions()\ncall\swould\sdo.\s\sThe\sdummy\sproc\scall\sis\sjust\na\svery\sindirect\sway\sto\scall\sthe\nTcl_ResetResult()\syou\sneed\sto\sget\sthe\ninterp\sback\sto\san\sinitial\sstate\swhere\nsimple\sreturn\sof\sTCL_RETURN\swill\scause\nno\strouble.\n\nHope\sthat\shelps.\s\sI'll\skeep\sthis\sreport\npending\sin\scase\syou\swant\sto\scomment\nfurther\sor\sseek\sadvice.\n\n
J login dgp
J mimetype text/plain
J username dgp
K 2152286fffffffffffffffffffffffffffffffff
U dgp
Z 57c472765eb8c22e50147c32b0585ee2