Re: Add signal handler for gtk_main_quit()



On Sun, 2006-04-02 at 08:31 +0200, David Necas (Yeti) wrote:
> On Sat, Apr 01, 2006 at 08:33:30PM -0800, yinglcs2 yahoo com wrote:
> > How can I add a signal handler for gtk_main_quit()?
> 
> gtk_main_quit() is not an action of any object, so how it
> could have a signal handler?
> 
> > I mean there are multiple places in my application
> > which calls gtk_main_quit(), but I want it to call a
> > 'cleanup handler' as part of the exit sequence.
> 
> See gtk_quit_add().

gtk_main_quit() doesn't exit the program, it simply returns from the
inner-most gtk_main_iteration(), typically called by gtk_run().
therefore, all cleanup can go right after you return from gtk_run(). 

gtk_main_quit() is quite problematic if you ever use recursive
invocations of gtk_run()/gtk_main_iteration(). not impossible to use,
but it took me a long time to figure out a reliable way to exit a
program that was potentially nested within 2 or even 3 levels of
gtk_main_iteration().

--p

ps. the solution was to add gtk_main_quit() as an idle callback






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