Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 79b96d42a3fdc0fabdf19b8c5c309bb428a7d478
Ticket: 3034840fffffffffffffffffffffffffffffffff
Crash in UpdateStringOfList()
User & Date: andreas_kupries on 2010-08-04 02:07:52
Changes

  1. icomment:
    Based on the attached RefCountFlow notes of mine it seems that calling InvokeTclMethod (ITM) with an RC=0 Tcl_Obj should consistently delete it before returning. It is only for RC=1 that argOne, argTwo can be both deleted and kept, depending on the code path taken.
    
    3. argOneObj    (a) CCOC,   modeObj,   RC=1.    RC-- @2194,    deleted.
                            RC++ @2225 RC=2,
                            RC-- @2296, RC=1, kept.
            (b) RWatch, maskObj,   RC=1    s.o.
            (c) RClose, ---------------
            (d) RGOpt,  ---------------
            (e) RIn,    toReadObj, RC=0    RC-- @2194, deleted.
                            RC++ @2225 RC=1,
                            RC-- @2296, RC=0, deleted.
    
    ChanCreateObjCmd()
        modeObj = DecodeEventMask() @1975 RC=1.
    
        InvokeTclMethod ( modeObj, NULL ) => resObj
        modeObj @593 RC-- /assumes ITM rc neutral to detail1. WRONG.
    ***    modeObj - may and may not be deleted in ITM.
    
    
    CCOC = ChanCreateObjCmd
    RXXX = ReflectXXX
    
    We cannot simply remove the code block going from lines 2193 to 2198. While that would fix things for the case RC=1, consistently keeping the arg* Tcl_Obj's, for the case RC=0 it would then start failing, keeping / deleting the Tcl_Obj based on code path.
    
    Best thing we can do IMHO is to consistently call ITM with arg* Tcl_Obj which are RC=1, plus removing that code block.
    
    Then the objects are consistently kept, and the caller has to delete, i.e. cleanup, by doing its own DecrRefCount.
    
    Does this agree with your (dgp) analysis as well ? 
    
    
  2. login: "andreas_kupries"
  3. mimetype: "text/plain"
  4. username: "andreas_kupries"