Re: Event loop hangup when using TimeoutSource and IdleSource



On Thu, 24 Sep 2009 16:27:11 -0400
Jim Hodapp <james hodapp gmail com> wrote:
> Chris,
> 
>      I am not setting up the Glib::signal_idle().connect() in a  
> separate thread from the main GUI thread. Only the library which  
> communicates with the device is in a separate thread. That library
> is all C and doesn't touch gtkmm or glibmm at all. The backtrace made
> me want to double check the scope on my instance of "this" that I'm  
> passing to the library, then the library passes to the callback  
> wrapper function in which the signal_idle connection uses to call
> the final callback function that modifies the GUI widget(s). I
> imagine if "this" went out of scope somehow that sigc and glibmm
> wouldn't like that much when destroying the idle handler reference.

Jim,

If you are passing arguments to an idle handler it is best to have
them on freestore and free them in the handler if they are not passed
by value, as of course they need to be around until the point at which
the main loop gets around to executing the slot. There is a separate
issue of the target object method invoked by the handler remaining in
existence, but you can get automatic slot disconnection with
sigc::trackable.  You are probably well aware of this and it may well
not be related to your problem.

Just out of interest (as I am interested in such things), how does the
device library thread communicate with the GUI thread?

Chris




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