Hi,
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
for this?

ie in pseudo code:
class Foo : Widget
{
  public Foo() : base()
  {
    GLib.Timeout.Add(1000, Bar);
  }

  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
automatically?

The documentation is very silent about this.

Thanks
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to