Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e0fb4278a3b5a9e2ab2e05b4960fe04930c2a9b2
Ticket: 2891556fffffffffffffffffffffffffffffffff
segfault in test encoding-24.2 (8.5)
User & Date: ferrieux on 2009-11-16 17:34:38
Changes

  1. icomment:
    Got it now. Mechanism:
       - when an escape encoding is loaded, as a side-effect it that its sub-encodings get in the encoding table with refcount 1.
       - at finalization table, the whole contents of the table are purged.
       - when an escape encoding is purged, the sub-encodings get purged recursively (EscapeFreeProc).
       - *if* the final (refcount==1) purge of a sub-encoding occurs *first* from within this sub scan, it gets properly removed from the toplevel table
      - *if* the (random) table hash order makes it so that the purge occurs *first* at toplevel, then the encoding gets nuked while being still referenced as a sub.; its pointer soon gets a stab in the sub scan --> CRASH.
    
    Note that incr'ing refcount on sub creation is not an option, because we'd then leak a ref at toplevel, hence in a non-finalization case (freeing an isolated escape encoding), we'd leak the subs.
    
    This all is a case where something like weak references would help, but we have only strong ones here.
    
    A simpler fix should be to detect the finalization case and refrain from the sub-scan FreeEnc() loop in EscapeFreeProc.
     
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"