Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e8a2b02b14bd517b6a6a4baf6015ba6e963c244c73368cf54fdcf0230e08d2c4
Ticket: 3422267ed6b79922ca6a69883d4e39901516443e
segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias
User & Date: pooryorick on 2020-08-31 17:24:06
Changes

  1. icomment:
    The issue this time is that <code>ProcBodyTestProcObjCmd()</code> synthesizes a
    proc body that imitates a Tcl Pro proc body and then passes it to
    <code>Tcl_ProcObjCmd()</code>, which recognizes it as a Tcl Pro compiled proc
    body and reuses the existing proc rather than creating a new proc.  This means
    that two different commands now share the same Proc structure, which is odd
    because the <code>Proc</code> structure itself keeps a pointer to the
    <code>Command</code> structure it is associated with.  Which command is it
    supposed to point to?  It seems that in the case of a Tcl Pro compiled
    procedure, a pointer to the most recent created command is stored, and previous
    information discarded. 
    
    In this unusual case, the <code>Proc</code> structure is shared between
    multiple commands, but that means that <code>Tcl_ProcObjCommand</code>  might
    replace the exising <code>procPtr->cmdPtr</code> with a new one.  When it does
    this it should decrement the reference count of the existing
    <code>cmdPtr</code>.
    
    Previously this wasn't an issue because reference counting of Command
    structures was limited to its occurrences in ByteCode instruction sequences.
    
    Fixed in [c045363cb0b77bf7].
    
  2. login: "pooryorick"
  3. mimetype: "text/x-fossil-wiki"