[RFC] Glib::Idle->add() and Glib::Timeout->add() with destroy notification parameter

hi all;

in GLib, g_idle_add() and g_timeout_add() have a _full() variant taking
the priority and a destroy notification function, which is usually used
to free the heap allocated data passed to the callback.

since the Glib Perl bindings allow passing default values to the
functions, they don't have the _full() variant; also, since Perl has
garbage collection, we don't usually need a destroy notification
function for the scalar passed to the callback.  the destroy
notification function can be (and it's often) used, though, for cleaning
up state after the idle or the timeout callback returns FALSE and is
removed from the main loop[1].

so I'd like to request the addition of a notify callback to
Glib::Idle->add() and Glib::Timeout->add(), set to undef by default, to
be called as the destroy notification function.  I can provide a patch,
unless someone either shows me how to do it differently with the current
Glib version, or demonstrates that my idea is pure crack and I should be
shot down. :-)



[1] random example:


the cleanup_load_items() is used to actually load the model into the
tree view once the lazy loading is done.

Emmanuele Bassi,  E: ebassi gmail com
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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