Re: Quitting an application
- From: Sujith <m sujith gmail com>
- To: "Gabriele Greco" <gabriele greco darts it>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Quitting an application
- Date: Fri, 28 Mar 2008 07:06:00 +0530
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;
Is spawning a thread and cooking up some simple synchronization scheme the only
way to quit gracefully ?
thanks,
Sujith
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]