Artifacts Associated With Ticket 218457
Ticket change [2fb355afb4] (rid 93107) by nobody on 2000-10-26 01:00:37:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 605 Bug Version: 8.0p2 SubmitDate: '1998-05-21' LastModified: '1999-08-06' Severity: SER Status: Released Submitter: hershey ChangedBy: hobbs OS: All OSVersion: NA Machine: NA FixedDate: '1999-08-06' FixedInVersion: 8.1.1 ClosedDate: '2000-10-25' There is a object reference count problem in Tcl_ForeachObjCmd in Tcl8.0p2. Tcl_ListObjGetElements does not increment the reference counts on the objects, so storing the objects in arrays and using them each time through the loop doesn't work. I tried incrementing the reference counts but this didn't work either. What did work was extracting the elements each time through the loop. Here is a patch. I know this is of dubious worth because I didn't track down the exact cause of the bug, but the reference count stuff is confusing and I don't have time to sort it out. John *** tclCmdAH.c 1998/04/10 18:56:28 1.1 --- tclCmdAH.c 1998/04/13 22:39:26 *************** *** 1530,1554 **** bodyPtr = argObjv[objc-1]; for (j = 0; j < maxj; j++) { for (i = 0; i < numLists; i++) { ! /* ! * If a variable or value list object has been converted to ! * another kind of Tcl object, convert it back to a list object ! * and refetch the pointer to its element array. ! */ ! ! if (argObjv[1+i*2]->typePtr != &tclListType) { ! result = Tcl_ListObjGetElements(interp, argObjv[1+i*2], ! &varcList[i], &varvList[i]); ! if (result != TCL_OK) { ! panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object\n", i); ! } } ! if (argObjv[2+i*2]->typePtr != &tclListType) { ! result = Tcl_ListObjGetElements(interp, argObjv[2+i*2], &argcList[i], &argvList[i]); ! if (result != TCL_OK) { ! panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object\n", i); ! } } for (v = 0; v < varcList[i]; v++) { --- 1530,1544 ---- bodyPtr = argObjv[objc-1]; for (j = 0; j < maxj; j++) { for (i = 0; i < numLists; i++) { ! result = Tcl_ListObjGetElements(interp, argObjv[1+i*2], ! &varcList[i], &varvList[i]); ! if (result != TCL_OK) { ! panic("Tcl_ForeachObjCmd: could not reconvert variable list %d to a list object\n", i); } ! result = Tcl_ListObjGetElements(interp, argObjv[2+i*2], &argcList[i], &argvList[i]); ! if (result != TCL_OK) { ! panic("Tcl_ForeachObjCmd: could not reconvert value list %d to a list object\n", i); } for (v = 0; v < varcList[i]; v++) { This has been fixed as of (or before) 8.1. -- 08/06/1999 hobbs - foundin initialized to: "obsolete: 8.0p2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "10. Objects"
- title initialized to: "Tcl_ForeachObjCmd bug in Tcl8.0p2"
- type initialized to: "Bug"
Ticket change [cc0cfad794] (rid 95623) by welch on 2000-10-26 08:22:17:
- closedate changed to: "2000-10-26T01:22:17"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"