GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Dec 19, 2014 8:41 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Synchornization g_idle_add - design
PostPosted: Mon Aug 11, 2014 11:44 am 
Offline
Familiar Face

Joined: Wed Apr 20, 2011 10:00 am
Posts: 10
I have a application which download or send files. Every operation like this is handled in different thread. Now I created a window which shows progress bars for each operation of that type. Progress bars are updated from within thread of given operation and because of that I use g_idle_add in them with gtk_progress_bar_set_fraction and other progress bar's related functions.

Everything worked fine but I wanted to allow user to delete progress bar by clicking on icon next to them and now I have a problem because when users clicks icon he closes thread of clicked operation but g_idle_add is still in run(because it attachs itself to main thread - it doesn't end itself when thread ends) and tries to update progress bar that doesn't exists anymore so I get Access Violation and I don't know how to redesign that part of my application to make it work.

Maybe there is a function which returns if any extra sources are attached to main loop? I am reading documentation but can't find anything like that.

Any suggestions/designed/ideas/anything highly appreciated.

SOLVED:

Using
Code:
g_main_context_iteration(NULL,TRUE);


before deleting progress bars resolved problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group