Re: Removing widgets in the main loop from another thread
- From: Chris Vine <chris cvine freeserve co uk>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list gnome org
- Subject: Re: Removing widgets in the main loop from another thread
- Date: Thu, 26 Feb 2009 14:23:27 +0000
On Thu, 26 Feb 2009 13:48:52 +0000
Chris Vine <chris cvine freeserve co uk> wrote:
> 3. You don't need to worry about an object ceasing to exist before a
> Glib::Dispatcher emission is executed via the main loop on one of its
> non-static methods if you derive the object from sigc::trackable. The
> invocation in that case would be a no-op. (Note however that
> sigc::trackable is not thread safe, so all slot creation and
> destruction on non-static methods of an object derived from
> sigc::trackable must occur in the thread which manages the lifetime of
> the object, which means amongst other things that you should not call
> Glib::Thread::create() on any non-static methods of the object).
A propos, in case you are also not aware, the Glib::Dispatcher object
must exist throughout emission and slot execution, so you are in
trouble if the Glib::Dispatcher object is a non-static member of the
object whose method is being executed via Glib::Dispatcher. Deriving
that object from sigc::trackable would avoid executing (via a signal)
one of its non-static methods after it has ceased to exist; but it would
not prevent a segfault when the main loop tries to look-up the (by then
not-existing) Glib::Dispatcher object to try to execute the signal
object it used to keep.
See this for further discussion:
http://mail.gnome.org/archives/gtkmm-list/2008-January/msg00048.html
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]