[Gtk-sharp-list] GLib Timeout and garbage collection clarification
zeno490 at gmail.com
Sun Feb 20 09:57:25 EST 2011
Looking at GLib.Timeout, there is only an Add function, no remove/delete.
If I have a gui element that creates a timeout to be called repeatedly at an
interval and eventually that widget is garbage collected, what happens to
the timeout handler? Will it still be called? Is there a guard internally
ie in pseudo code:
class Foo : Widget
public Foo() : base()
private bool Bar()
SomeLabel.Text = DateTime.Now.ToString(); // Is this always safe?
SomeLabel might have been GCed if "this" has been GCed as well?
return true; // ???
Should I override dispose, set a flag that is checked in the handler and
return false then? Is that safe? Will the object still be "live" when the
handler next attempts to fire? Is the GTK underlying system smart enough to
detect that the handler's source has been GCed and thus should be removed
The documentation is very silent about this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gtk-sharp-list