Re: Quitting an application




I am writing a music library manager and I have a small problem when
terminating the application.
On starting the app, I scan a DB and load the tracks into a treeview.
When this is in progress, if the user closes the application, a segfault
occurs
because gtk_main_quit() has been called and the scanning function tries to
access
data structures that are no more. How do I synchronize between them ?


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()) :)

-- 
Bye,
 Gabry



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