GtkTreeView: g_signal_handlers_unblock_by_func



Hi all,

To avoid some reentrant callbacks, in a few cases I have to use code such as:

g_signal_handlers_block_by_func (widget, func, data);
do_stuff;
g_signal_handlers_unblock_by_func (widget, func, data);

Usually this works fine, but I have a Treeview where unblock
seems to be done too early, before GTK finnishes handling do_stuff, resulting in undesired callbacks. I solved the problem using a timer such as (to delay the unblock):

g_signal_handlers_block_by_func (widget, func, data);
do_stuff;
g_timeout_add (0, my_timer, data);

int my_timer (void *data)
{
g_signal_handlers_unblock_by_func (widget, func, data);
return FALSE;
}

As I said, this seems to work fine in all systems I tested (even with the timer delay set to 0...).

My questions are: 1) is there a better, more elegant, more robust, way of doing this? 2) why the bock/unblock mechanism does not work as expected in treeview?

Best regards,
Carlos



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