Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3a9fa4fb7f702c56f80247f1eeb98e9cbda85163
Ticket: 3475569fffffffffffffffffffffffffffffffff
Unexpected behavior / Panic / Tcl_Obj deletion management
User & Date: sebres on 2012-01-23 17:49:24
Changes

  1. icomment:
    spoon-feeding the issue to you:
    
    IMHO it's not a problem of "Path Management", but a problem of "Delete Pending" feature (so i move that again in the category "10. Objects"). 
    Although I have found it in calls such "file normalize", but it's possible anywhere, if delete pending on.
    And IMHO my attached path was a workaround, the solution would be a rewriting of delete pending functionality:
    > the DeletePending mechanism must be changed, for example using "Epoch" in Obj struct 
    > (the objects created in DeletePending mode could be deleted directly without PushObjToDelete) ...
    > Or completelly removed from core.
    
    I have attached the example C code (with example TCL code within comment bottom) and a ready dll,
    with which you could reproduce/test any tcl function with delete pending.
    
    Now spoon-feed the problem:
    If you write following, it is legal (i know that refCount = 1): 
      Tcl_Obj * objPtr = Tcl_NewObj();
      Tcl_IncrRefCount(objPtr);
      Tcl_AppendToObj(objPtr, "test", -1);
      Tcl_AppendToObj(objPtr, "test2", -1);
    But if tomorrow Tcl_AppendToObj will be modified, so it attaches objPtr to any "list", increments refCount of "list" and hereafter decrements refCount of this "list" again.
    This means, that this code will not work properly by "Delete Pending", cause the decrementing refCount of "list" does not destroy it, and refCount of objPtr remains 2.
    
    
  2. login: "sebres"
  3. mimetype: "text/plain"
  4. subsystem changed to: "10. Objects"
  5. username: "sebres"