Re: Quitting an application
- From: Bastiaan Veelo <bastiaan sarc nl>
- To: Sujith <m sujith gmail com>
- Cc: Gabriele Greco <gabriele greco darts it>, gtk-app-devel-list gnome org
- Subject: Re: Quitting an application
- Date: Fri, 28 Mar 2008 18:43:37 +0100
Sujith wrote:
Gabriele Greco writes:
> Intercept the delete_event or modify the callback where you do the
> gtk_main_quit() and insert there some thread sync code.
>
> You should take care also when you add the rows to your Tree/ListStore if
> you do that directly from the thread that scans the db.
>
> I suppose there is a thread since if there isn't one when you quit the main
> loop nothing can crash it (except something you call after gtk_main()) :)
>
I don't have a separate thread that does the DB scanning.
The sequence of operations is something like this:
1 * Init various GUI elements including the track treeview.
2 * Read the DB and append elements to the treeview.
3 * call gtk_main() and wait for events.
Now, if the user quits between 2 and 3, it becomes an issue because gtk_main()
hasn't been called yet and I can't check for the main loop.
If gtk_main() has been invoked, I can check for the existence of the mainloop like this:
while(gtk_events_pending())
if (gtk_main_iteration_do(FALSE))
return;
I have not checked, but maybe gtk_main_leve() returns 0 if gtk_main()
has not been called yet? If that would be of any help.
Is spawning a thread and cooking up some simple synchronization scheme the only
way to quit gracefully ?
thanks,
Sujith
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]