Artifacts Associated With Ticket 1740631
Ticket change [254ed32d79] (rid 88149) by nobody on 2007-06-20 23:22:43:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Solaris 10 on sparc Calling Tcl_UnlinkVar in a callback that is invoked by Tcl_UpdateLinkedVar causes memory corruption because linkPtr is used after it has been freed. Here is a patch to fix the problem by making a second call to Tcl_VarTraceInfo. --- tcl8.4.15/generic/tclLink.c 2007-05-10 11:23:58.000000000 -0700 +++ tcl8.4.15-new/generic/tclLink.c 2007-06-20 14:19:24.792783000 -0700 @@ -206,6 +206,12 @@ Tcl_IncrRefCount(objPtr); Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, objPtr, TCL_GLOBAL_ONLY); Tcl_DecrRefCount(objPtr); + /* Callback may have unlinked the variable */ + linkPtr = (Link *) Tcl_VarTraceInfo(interp, varName, TCL_GLOBAL_ONLY, + LinkTraceProc, (ClientData) NULL); + if (linkPtr == NULL) { + return; + } linkPtr->flags = (linkPtr->flags & ~LINK_BEING_UPDATED) | savedFlag; } - foundin initialized to: "obsolete: 8.4.15"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "09. Linked C Variables"
- title initialized to: "Memory corruption in Tcl_UpdateLinkedVar"
- type initialized to: "Bug"
Ticket change [fc7af5e039] (rid 108248) by dkf on 2007-06-21 17:48:35:
- priority changed to: "9 Immediate"
Ticket change [99da1ed6ae] (rid 110859) by emaros on 2007-07-17 02:59:08:
- icomment:
Logged In: YES user_id=334297 Originator: NO This patch has allowed our application to run continuously for several weeks where before we would have aborts once a day.
- login: "emaros"
- mimetype: "text/plain"
- username: "emaros"
- icomment:
Ticket change [e087812afd] (rid 115214) by hobbs on 2007-09-11 06:06:42:
- closedate changed to: "2007-09-10T23:06:42"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 Originator: NO In 8.4.16 and 8.5b1.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "hobbs"