Re: gtk_main_quit() and destruction




Hrvoje Niksic <hniksic@srce.hr> writes:

> When gtk_main_quit() is invoked, are the destruction callbacks
> properly called?  Specifically, I would expect the "destroy" callback
> to be called after gtk_main_quit() is used to kill off the whole
> thing.
> 
> Take this code: it sets up a window, realizes it, and adds a timeout
> that makes sure gtk_main_quit() is called as soon as gtk_main_loop()
> is entered.  Here I would expect the "destroy" handler to be invoked,
> but apparently it isn't.
>
> How do I make sure my "destroy" handler is invoked even in the face of
> gtk_main_quit()?  I need it to make sure that some cleanups are done
> (e.g. processes killed) when the windows associated to them get
> destroyed.

Well, the easiest way is just to insert your cleanup calls
immediately after your call to gtk_main(). When you call
gtk_main_quit(), the gtk_main() will exit and return 
to your code.

gtk_main_quit() does no destruction of windows. It is 
just saying "exit the main loop and return to the caller".

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]