Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e0764f3bda3c59ecfdb9ab2e85871902a0284342
Ticket: 1334947fffffffffffffffffffffffffffffffff
refCounts on PtrSetVar failure
User & Date: msofer on 2005-10-23 05:42:37
Changes

  1. icomment:
    Logged In: YES 
    user_id=148712
    
    Clarifying my thoughts: the real "bug" is that some failure
    paths do not clear 0-ref objs, some do not. This makes it
    imperative for callers to manage the refCount explicitly. 
    
    If a new obj is created by the caller and used as new value
    without incrementing its refCount, the handling of error
    returns is impossible to get right:either you DecrRefCount
    and crash on errors caused by traces, or you don't and leak
    the obj on other errors.
    
    My preference for alternative (b) is that it allows the
    fire-and-forget technique: just call e.g. 
      Tcl_ObjSetVar2(interp, part1Ptr, part2Ptr, Tcl_NewObj(),
    flags)
    and forget all about that object's fate in the knowledge
    that it will be disposed of proeprly (as is currently done
    in  error by eg Tcl_AddObjErrorInfo).
    
    Maybe a similar policy would make sense for other
    interfaces, eg Tcl_ListObjAppendElement?
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"