[Gtk-sharp-list] Timers & GLib.Timeout, passing arguments?

Jonathan Pryor jonpryor@vt.edu
04 Jun 2003 11:05:14 -0400


On Wed, 2003-06-04 at 10:47, Matt Williams wrote:
<snip/>
> If the handler is not static then I have the problem that I'm not sure
> how to handle the case when the object and thus the instance of the
> handler is destroyed.
<snip/>
> matt

That shouldn't happen.  The creation of the GLib.TimeoutHandler delegate
should ensure that your class instance is kept in memory *at least* as
long as the delegate is kept in memory (the glory of garbage
collection).  Presumably the delegate will be kept in memory as long as
GLib.Timeout will attempt to invoke it (i.e. until you unregister the
handler).

If it does happen, that probably points to a bug in the GLib.Timeout
wrapper.  Object instances shouldn't mysteriously "disappear," and then
have methods invoked on non-existent objects.

I may be wrong, but if I am wrong then this is NOT obvious, and it
should be fixed so that the behavior IS obvious.

 - Jon