[exit] not equal [destroy .]
Closed / Rejected227269ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 20 years ago
Descriptionplain2001-01-02 10:19:14
WinNT, Tcl/Tk 8.3.2
I developed a tcl-extension (DLL) and noticed that the delete-proc for my command is not always called.
I searched the source but could not find a hint. Tcl and Tk seem to finally call Tcl_Exit(), but the problem seems to be somewhere before that, since calling Tcl_Exit() in my DLL would not call delete-proc either.
a button with -command {exit} ## or tclsh and call [exit]
==> delete-proc *not* called
a button with -command {destroy .}
==> delete-proc *is* called
dkf Ticket [227269ffff]: 1 change
[History diff]2001-01-16 21:33:24
dgpplain2001-02-08 07:06:43
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.
dgp Ticket [227269ffff]: 2 changes
[History diff]2001-04-05 08:13:49
dgp Ticket [227269ffff]: 1 change
[History diff]2001-04-05 08:15:02
dgpplain2001-04-17 04:42:20
Logged In: YES user_id=80530 See also FR 218075
dgp Ticket [227269ffff]: 1 change
[History diff]2003-11-13 06:02:58
dgpplain2006-06-10 02:48:48
Logged In: YES user_id=80530 see comments @ FR 218075
Log in (anonymous is fine) to add a comment.