Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e570077f2fc5dd8723778a5e9f202af548d4e61f9e83ceace46be2d65ec78ab3
Ticket: b343fe8656c16b2e02580f68423b6ef03463915c
TIP 636 Tcl_ListObjIndex incompatibility not documented
User & Date: apnadkarni on 2024-11-29 00:03:53
Changes

  1. icomment:
    I *think* that branch mostly describes what the caller needs to do except for one case.
    
    1. `Tcl_ListObjIndex` may return a `Tcl_Obj` with (a) an internal reference held (non-0 ref count) or (b) a 0 ref count.
    
    2. The caller may either (a) hold on to the object, (b) simply access the content and dispose of it, or (c) pass it to another function.
    
    The case not described that needs more clarity is 1(b) with 2(c). In that case, I don't think `Tcl_BounceRefCount` is always safe. In particular if the second function that is called is a "hairy monster" like `Tcl_ObjSetVar2`, the correct sequence is wrapping that call between a IncrRefCount and DecrRefCount and not Bounce.
    
    But explaining that succinctly is another matter.
    
    A related note - there is also a REFERENCE COUNT MANAGEMENT section in that page.
    
    My suggestion is to merge into the trunk but leave this ticket open as a reminder to clarify the abovementioned case.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"