Overview
| Artifact ID: | 96f21b8d813d50c0728d625b0ebffc489840a27b |
|---|---|
| Ticket: | 3602706fffffffffffffffffffffffffffffffff
Segfault on tclsh startup |
| User & Date: | nijtmans on 2013-02-01 16:49:52 |
Changes
- icomment:
In tclParse.c, I see the following code: .... arrayIndex = Tcl_GetObjResult(interp); Tcl_IncrRefCount(arrayIndex); .... varName = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); appendObj = Tcl_ObjGetVar2(interp, varName, arrayIndex, TCL_LEAVE_ERR_MSG); Tcl_DecrRefCount(varName); .... if (arrayIndex != NULL) { Tcl_DecrRefCount(arrayIndex); } So, for 'arrayIndex' the refCount is incremented before the Tcl_ObjGetVar2 call, but for 'varName' it is not! For "novem" it might be better to let Tcl_ObjGetVar2 clean up part1Ptr and part2Ptr if the refCount is 0. That would allow to simplify the above code to: .... arrayIndex = Tcl_GetObjResult(interp); /* Tcl_IncrRefCount(arrayIndex); No longer necessary */ .... varName = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); appendObj = Tcl_ObjGetVar2(interp, varName, arrayIndex, TCL_LEAVE_ERR_MSG); /* Tcl_DecrRefCount(varName); No longer necessary */ .... /* if (arrayIndex != NULL) { Tcl_DecrRefCount(arrayIndex); } No longer necessary */ - login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"