Skip to content
Tcl Source Code History Of Ticket 1904432
Login

History Of Ticket 1904432

Artifacts Associated With Ticket 1904432

  1. Ticket change [10996932a3] (rid 94996) by nobody on 2008-02-29 04:39:31:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.4.17"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nobody"
    10. subsystem initialized to: "18. Commands M-Z"
    11. title initialized to: "Tcl_DeleteCommandFromToken and NULL token"
    12. type initialized to: "RFE"
  2. Ticket change [0b57484a82] (rid 113966) by dgp on 2008-03-12 02:47:25:

    1. assignee changed to: "msofer"
    2. foundin changed to: "None"
    3. icomment:
      
      
      data_type - 360894
      
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      I think you've misread the documentation.
      
      "If  the  command  corresponding  to token has already been deleted from
      interp then Tcl_DeleteCommand does nothing and returns -1; otherwise it
      returns 0."
      
      But you are not passing a token value of
      an already deleted command.  You are passing
      the value NULL.  And NULL values lead to crashes.
      
      There may be a convenience case to be made for
      changing this, but that's a feature request, not
      a bug.
      
      
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. subsystem changed to: "45. Parsing and Eval"
    7. username: "dgp"
  3. Ticket change [f0b3baeb4a] (rid 109241) by dgp on 2008-03-12 02:52:31:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      Curious that the docs report the value -1
      will be returned for tokens not registered
      in the interp, but I can't see any way the
      routine ever does that.  There may be a bug
      here after all.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [d940055aed] (rid 107578) by dgp on 2008-03-12 02:58:07:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      As long as the sources have been in CVS
      (around 8.0p2), I can't see any evidence
      the T_DCFT() routine ever returned -1.
      
      T_DCFT() was new in Tcl 8.0.  Were these
      docs ever right?
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [c8cd1e6eff] (rid 148250) by dkf on 2016-07-24 18:15:56:

    1. assignee changed to: "dkf"
    2. closer changed to: "nobody"
    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. icomment:
      Might be worth fixing this according to the principle of <i>Do Nothing, Gracefully</i>.
      
    5. login: "dkf"
    6. mimetype: "text/html"
    7. severity changed to: "Minor"
    8. username: "dkf"