Re: how to fully quit out of recursive main loops?



Paul Davis <pbd op net> writes: 
>      g_main_quit_all ();
> 
> which would apply g_main_quit() to all current main loops.
> 
> it seems like a rather serious design defect,

I think you are just writing your code in a way no one else writes
their code. ;-) Main loops are supposed to be orthogonal to one
another. gtk_main_quit() doesn't "mean" exit the app, that's just 
an interpretation specific apps can apply to it; but if you do that 
you have to be sure you also have a way to quit all loops, e.g. by
recording all loops in a list when you enter them, or have a policy
that extra loops will forbid quitting while they are running. I
usually do the latter.

> though hardly surpising
> given the reprehensible way that gtk_exit() works (calling exit(2)).

gtk_exit() is totally useless and always has been. Deprecated in 2.0.

> i would have thought that a way to say "stop the GUI and release its
> resources" was rather important :)

The number of GUI apps that want to shut down their GUI and never use
it again is... pretty close to zero. And in the few exception cases,
they can use multiple processes.

> oh well, setjmp/longjmp seems to be it :(

Be careful, longjmp()'ing with GTK stuff on the stack will not make
GTK happy.

Havoc



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