Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 71ac8e1a0902139dd17ce955bf7478049f95440567c1271980923c54927df53a
Ticket: 79474c58800cdf94559a2c01230b4536aa416016
refchan segfault
User & Date: sebres on 2024-05-16 19:19:10
Changes

  1. icomment:
    OK, it looks like a `name` of reflected channel itself (the object is `rcPtr->name`, and after ref-decrement in `FreeReflectedChannel` its `refCount` is still 2, so has been not removed and hold the statePtr of channel within).
    
    
    The issue is therefore not related to this ticket and/or fix...<br/>
    It is simply a weird constellation: object containing the channel name (rc0) is referenced in reflected channel itself, and if the channel gets closed as long as its state is preserved several times (so FreeReflectedChannel doesn't remove it), a typical cyclic reference gets created:
    
    - `rcPtr->name` (Tcl_Obj of channel type) holds the ref to `statePtr`,
    - `statePtr` holds the ref to channel,
    - `chanPtr` holds the ref to reflected (`rcPtr` via `chanPtr->instanceData`),
    - `rcPtr` holds the ref to `rcPtr->name` (and cycle got closed).
    
    I'll try to solve that somehow as part of this fix.
    
  2. login: "sebres"
  3. mimetype: "text/x-markdown"