Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 10996932a3ab4d1821fef288a0e82b2f1622f0db
Ticket: 1904432fffffffffffffffffffffffffffffffff
Tcl_DeleteCommandFromToken and NULL token
User & Date: nobody on 2008-02-29 04:39:31
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I create a command with Tcl_CreateObjCommand and register a delete procedure. Creation of the object and deletion of the object work fine. However, if the object is deleted a second time, I get segfaults. The only way for this to happen is if the object's delete procedure is being called, which shouldn't be happening. After the initial call to Tcl_DeleteCommandFromToken, any subsequent call to Tcl_GetCommandFromObj for that object should have returned NULL, and Tcl_DeleteCommandFromToken, being called with a NULL token, should have returned -1.
    
    The following code does not work as intended when an attempt is made to delete an object more than once.
    
    Tcl_DeleteCommandFromToken(interp, Tcl_GetCommandFromObj(interp, objv[i]));
    
    The following code is required for this to work:
    
    if ((token = Tcl_GetCommandFromObj(interp, objv[i]))) { 
       Tcl_DeleteCommandFromToken(interp, token);
    }
    
    I believe that the desired result for Tcl_DeleteCommandFromToken, when called with a NULL token, should be to return -1, per the documentation.
    
  4. foundin changed to: "obsolete: 8.4.17"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "nobody"
  10. subsystem changed to: "18. Commands M-Z"
  11. title changed to: "Tcl_DeleteCommandFromToken and NULL token"
  12. type changed to: "RFE"