Re: Quitting an application



On Thu, Mar 27, 2008 at 08:01:40PM +0530, Sujith wrote:
Hi,

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 ?

This is a quite common problem in GUI design. How do you syncronize 
between a long job and a short fast one (as quitting). The first answer 
is that you should not do any long jobs. You should split the long work
in small ones, and let every other job have the ability to run. 
Alternative you could make a coprocess to read the DB and when the work
is done you get the result in one "operation". 

Well - the real answer is - it could be difficult. You might turn to 
some syncronization mechanism or maybee threads...

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse           email: gorhas raditex se  Tel: 08-6949270
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------




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