is thaere a way to exit(1)?
I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: > I finally know =where= i want to exit my gtk program, but exit > just doesn't break me out of my while() loop. what's the magin? exit() *does* terminate the program no matter what loop or whatever it might be running. So, most likely, you think your code calls exit() at some point but that actually never happens. The program might get stuck in the finalisation phase if some exit handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose if you were registering such things you (a) would have told us (b) did not wonder what happened. Yeti P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. Normally one calls gtk_main_quit() and the program continues execution after gtk_main() – which typically means it then reaches the end of main() and terminates. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: > > On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: > > I finally know =where= i want to exit my gtk program, but exit > > just doesn't break me out of my while() loop. what's the magin? > > exit() *does* terminate the program no matter what loop or whatever it > might be running. > > So, most likely, you think your code calls exit() at some point but that > actually never happens. > > The program might get stuck in the finalisation phase if some exit > handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose > if you were registering such things you (a) would have told us (b) did > not wonder what happened. > > Yeti > > > P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. > Normally one calls gtk_main_quit() and the program continues execution > after gtk_main() ??? which typically means it then reaches the end of > main() and terminates. > you were abs correct about exit(). i moved it around and was able to verify that my code was doing what i had thought. that puts me back to the problem of my gtk application going dark/dim; it looks like this may be a feature of ubuntu linux. i've posted to unubtuforums and waiting. --at any rate, thanks for your help. gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On 01/15/2012 12:51 AM, Gary Kline wrote: > On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: >> On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: >>> I finally know =where= i want to exit my gtk program, but exit >>> just doesn't break me out of my while() loop. what's the magin? >> exit() *does* terminate the program no matter what loop or whatever it >> might be running. >> >> So, most likely, you think your code calls exit() at some point but that >> actually never happens. >> >> The program might get stuck in the finalisation phase if some exit >> handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose >> if you were registering such things you (a) would have told us (b) did >> not wonder what happened. >> >> Yeti >> >> >> P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. >> Normally one calls gtk_main_quit() and the program continues execution >> after gtk_main() ??? which typically means it then reaches the end of >> main() and terminates. >> > > you were abs correct about exit(). i moved it around and > was able to verify that my code was doing what i had > thought. that puts me back to the problem of my gtk > application going dark/dim; This usually indicates that an application is busy. Run the app inside gdb, break into gdb when it is gray and check the backtrace. Stefan > it looks like this may be a > feature of ubuntu linux. i've posted to unubtuforums and > waiting. --at any rate, thanks for your help. > > gary > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Tue, Jan 17, 2012 at 04:34:32PM +0100, Stefan Sauer wrote: > Date: Tue, 17 Jan 2012 16:34:32 +0100 > From: Stefan Sauer > Subject: Re: is thaere a way to exit(1)? > To: gtk-app-devel-list@gnome.org > > On 01/15/2012 12:51 AM, Gary Kline wrote: > > On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: > >> On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: > >>> I finally know =where= i want to exit my gtk program, but exit > >>> just doesn't break me out of my while() loop. what's the magin? > >> exit() *does* terminate the program no matter what loop or whatever it > >> might be running. > >> > >> So, most likely, you think your code calls exit() at some point but that > >> actually never happens. > >> > >> The program might get stuck in the finalisation phase if some exit > >> handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose > >> if you were registering such things you (a) would have told us (b) did > >> not wonder what happened. > >> > >> Yeti > >> > >> > >> P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. > >> Normally one calls gtk_main_quit() and the program continues execution > >> after gtk_main() ??? which typically means it then reaches the end of > >> main() and terminates. > >> > > > > you were abs correct about exit(). i moved it around and > > was able to verify that my code was doing what i had > > thought. that puts me back to the problem of my gtk > > application going dark/dim; > This usually indicates that an application is busy. Run the app inside > gdb, break into gdb when it is gray and check the backtrace. > > Stefan well, it =is= busy. it's looping endlessly; but then i limited it to 5 loops with a for-loop. same. (i thought my programming skills were better that having to use the debugger, but may have to.) before, i am going to scp everything over to my eee-900a that runs debian. see if it runs there. i hope i don't see smoke rising from the netbook :-) gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On 01/17/2012 03:35 PM, Gary Kline wrote: > well, it =is= busy. it's looping endlessly; but then i > limited it to 5 loops with a for-loop. same. (i thought my > programming skills were better that having to use the > debugger, but may have to.) before, i am going to scp > everything over to my eee-900a that runs debian. see if it > runs there. i hope i don't see smoke rising from the > netbook :-) I think the problem is you are approaching your problem from a traditional, procedural point of view. That isn't going to work in event-driven apps, which is what GTK apps are. If in your code you are looping endlessly, you are preventing GTK from handling events. This means that no X11 events (mouse, keyboard, etc) are processed. Your window manager detects this and makes your app turn gray which signifies to the user that the app is hung (not responding to input). If you need to do a long-running task in GTK, either spawn a thread to do the work, allowing control of the main thread to return to GTK's main loop, or during your loop you have to iterate the GTK main event loop by doing something like this in your code: while (gtk_events_pending ()) { gtk_main_iteration (); } In general, in a callback you must return control to GTK asap for the GUI to keep running. Hope this helps. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list