Skip to content
Tcl Source Code Artifact [f212633e2c]
Login

Artifact [f212633e2c]

Artifact f212633e2c3c1bb34f0507e53c853e56ac8ac4cf:

Ticket change [f212633e2c] - New ticket [3475569fffffffff|3475569fff] <i>Unexpected behavior / Panic / Tcl_Obj deletion management</i>. by sebres on 2012-01-18 16:37:33.
D 2012-01-18T16:37:33
J assignee msofer
J cmimetype text/plain
J comment Platform:\sANY;\nArea:\sTcl\score,\sDeletePending;\n\nI\shave\san\sunexpected\sbehavior,\sthat\scan\sbe\sreproduced\sonly\sif\san\sTcl_Obj\swill\sbe\sdestroyed\s(in\sa\sfreeIntRepProc\sof\sthis)\s-\salso\sObjDeletePending(contextPtr)\sis\strue.\s\nBy\scall\sof\sTclFSNormalizeAbsolutePath\sthrough\s"link\s=\sTcl_FSLink(retVal,\sNULL,\s0);",\sthe\sretVal\swill\sbe\sshared\sobj\s(refCount\s=\s2),\shereafter\sby\scall\s"Tcl_SetObjLength(retVal,\s...);"\sa\sPANIC\s("Tcl_SetObjLength\scalled\swith\sshared\sobject"),\shereafter\sfolowing\sException,\saccess\svio\setc.\nThe\sproblem\sis\sTcl_FSJoinToPath(pathPtr,...),\sthat\sincr\srefCount\sof\sobject\s"pathPtr"\safter\sthat\scalled.\sI\shave\sattached\sa\spatch,\sthat\si\screated\sto\swork\saround\sproblem.\n\nIn\saddition\sthe\ssimple\scode,\sthat\swill\sbe\scorrectly\sexecuted\s"normally"\sand\sperfect\sunexpected\spanic\sin\s"DeletePending"\smode:\n<code>\n\sTcl_Obj\s*\sobj;\n\sTcl_Obj\s*\slist;\n\sTcl_Obj\s*\sret;\n\s\s//\sbrand\snew\sobj\s\n\s\sobj\s=\sTcl_NewListObj(0,\sNULL);\n\s\sTcl_IncrRefCount(obj);\n\s\s//\sbrand\snew\sparent\s\n\s\slist\s=\sTcl_NewListObj(1,\s&obj);\n\s\sTcl_IncrRefCount(list);\n\s\s//\s...\shere\sanything\selse\s...\s//\n\s\s//\sdelete\sparent\s...\n\s\sTcl_DecrRefCount(list);\n\s\s//\shere\sobj->refCount\sshould\sbe\s1\s(and\snormally\salso\s1),\sbut\sin\s"DeletePending"\smode\sit\sis\s2\s...\n\s\s//\salso\shere\sBOOM\sif\sDeletePending\s:\n\s\sTcl_SetObjLength(obj,\s0);\n\s\s//\s...\shere\sanything\selse\s...\s//\n\s\s//\sdelete\sobject\n\s\sTcl_DecrRefCount(obj);\n</code>\n\nIn\smy\sopinion,\sthe\sDeletePending\smechanism\smust\sbe\schanged,\sfor\sexample\susing\s"Epoch"\sin\sObj\sstruct\s(the\sobjects\screated\sin\sDeletePending\smode\scould\sbe\sdeleted\sdirectly\swithout\sPushObjToDelete)\s...\s\nOr\scompletelly\sremoved\sfrom\score.\nOn\severy\scase,\sall\stcl\stests\sshould\sbe\sextended\sto\scheck\sit\sin\sDeletePending\smode.\n
J foundin obsolete:\s8.5.11
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter sebres
J subsystem 10.\sObjects
J title Unexpected\sbehavior\s/\sPanic\s/\sTcl_Obj\sdeletion\smanagement
J type Bug
K 3475569fffffffffffffffffffffffffffffffff
U sebres
Z 72538cc7d6ebbec563c59148a7d91dc6