Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 58de0cc450e5361c2f587f38c6c749fc154ab222
Ticket: 227269ffffffffffffffffffffffffffffffffff
[exit] not equal [destroy .]
User & Date: dgp on 2001-02-08 07:06:43
Changes

  1. icomment:
    By delete-proc, I assume you're talking about the
    deleteProc argument (of type (Tcl_CmdDeleteProc *))
    passed as the fifth argument to Tcl_Create(Obj)Command().
    
    Your delete-proc will only be called if Tcl_DeleteCommand*()
    is called on your command.  One way that can happen is
    if Tcl_DeleteInterp() is called on the interp containing
    your command.  That's what happens when wish exits after
    it detects it has no more windows to manage (after
    [destroy .]).
    
    On the other hand, Tcl_Exit() (and/or Tcl_Finalize())
    does not call Tcl_DeleteInterp() on the interpreters
    in the process.  If you need your deleteProc to be called
    on a Tcl_Exit, you must register an exit handler yourself
    with Tcl_CreateExitHandler().  That's the solution with
    Tcl as it is.
    
     * * * *
    
    One might argue that Tcl_CreateInterp() should register
    its own exit handler so that Tcl_Exit() destroys all
    interps.  That new feature would also give you what you
    want, but it would need to be proposed to the core team
    in a TIP for careful consideration.
    
    One might also question why Tk_Main() ends with a call
    to Tcl_DeleteInterp(), but Tcl_Main() does not.
    
    In short, there's no bug here, but there may be a 
    mis-feature or two.
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"