<i>Thread package fails to consider the interp it was initially loaded from was deleted</i>.
by
.
D 2016-06-11T14:47:02.301
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment The\sthread\spackage\scommands\scall\sa\sfunction\snamed\sInit\sand\spasses\salong\sthe\scaller's\sinterpreter.\sInit\scaches\sthe\sinterp\sin\sthread\slocal\sstorage\sif\sit\shasn't\sbeen\sset\syet\sand\suses\sit\sfor\sall\sfuture\sinvocations.\sIf\sthe\sinterp\sis\slater\sdeleted\sthis\swill\slead\sto\san\serror\s("attempt\sto\scall\seval\sin\sdeleted\sinterpreter")\swhen\scommunicating\swith\sits\sparent\sthread\svia\scommands\slike\sthread::send.\s\s\r\n\r\nThere\sis\sa\sdemo\sof\sthis\shere:\shttp://paste.tclhelp.net/?id=idf\r\nIf\sthis\sis\sa\sWon't\sFix\sI\spropose\sthe\sdocs\sbe\supdated\sto\swarn\sagainst\sdeleting\sthe\scalling\sinterp\sto\ssave\ssomeone\selse\ssome\spain.\r\n\r\nCorrecting\sthe\sbehavior\sseems\strivial\sand\sshouldn't\shave\sany\snoticable\sperformance\simpact.\sThe\sfunction\sshown\sbelow\sseems\sto\ssolve\sthe\sproblem:\r\n\r\nstatic\svoid\r\nInit(interp)\r\n\s\s\s\sTcl_Interp\s*interp;\s\s\s\s\s\s\s\s\s/*\sCurrent\sinterpreter.\s*/\r\n{\r\n\s\s\s\sThreadSpecificData\s*tsdPtr\s=\sTCL_TSD_INIT(&dataKey);\r\n\r\n\s\s\s\sif\s(tsdPtr->interp\s==\s(Tcl_Interp*)NULL)\s{\r\n\s\s\s\s\s\s\s\smemset(tsdPtr,\s0,\ssizeof(ThreadSpecificData));\r\n\s\s\s\s\s\s\s\stsdPtr->interp\s=\sinterp;\r\n\s\s\s\s\s\s\s\sListUpdate(tsdPtr);\r\n\s\s\s\s\s\s\s\sTcl_CreateThreadExitHandler(ThreadExitProc,\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(ClientData)threadEmptyResult);\r\n\s\s\s\s}\selse\sif\s(Tcl_InterpDeleted(tsdPtr->interp))\s{\r\n\s\s\s\s\s\s\s\stsdPtr->interp\s=\sinterp;\r\n\s\s\s\s}\r\n}
J foundin 8.6.5
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact 45acae529cab3ab98979b4963483a82f50bb42e5
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem 80.\sThread\sPackage
J title Thread\spackage\sfails\sto\sconsider\sthe\sinterp\sit\swas\sinitially\sloaded\sfrom\swas\sdeleted
J type Bug
K 518f1f22be08de2451152907b0136b0fe871e9ce
U anonymous
Z 94f398ea9f31f9518a27a81c18b5b49d