Tricky treemodel question



I am creating a custom tree model and when a row is expanded there is
sometimes considerable work to be done. I can break that work up to some
level and am emitting libsigc++ signals that the main window class is
attached to and the main window then sets a progress bar so that I can
give some indication of progress.

The problem comes in where I have to do something like
        while( gtk_events_pending() )
            gtk_main_iteration_do(false);
after setting the progress bar so that GTK repaints the new bar
position. However I am getting the following error which I think is
caused by GTK trying to repaint the gtktreeview again. 
ie. I click to expand the row, the treeview calls
tree_store_iter_children() which is my model function which starts
'reading' the children (sometimes over the network) and emits events as
it goes. These events trigger a gtk_main_iteration_do() so that the gtk
progressbar is updated, but GTK also tries to update the treeview which
is not ready to be updated because its has called
tree_store_iter_children() and is not in a state to be redrawn.

So my question really is: Is it always acceptable to call 
gtk_events_pending && gtk_main_iteration_do from a GTK+2 app?


#0  0x417b6a01 in __kill () at __kill:-1
#1  0x401005bb in raise (sig=6) at signals.c:65
#2  0x417b7f82 in abort () at ../sysdeps/generic/abort.c:88
#3  0x406b722c in g_logv (log_domain=0x415448eb "Gtk",
log_level=G_LOG_LEVEL_ERROR, 
    format=0x41545020 "file %s: line %d (%s): assertion failed: (%s)",
args1=0xbfffd66c "¶¥ZAé\v") at gmessages.c:507
#4  0x406b72b8 in g_log (log_domain=0x415448eb "Gtk",
log_level=G_LOG_LEVEL_ERROR, 
    format=0x41545020 "file %s: line %d (%s): assertion failed: (%s)")
at gmessages.c:526
#5  0x4150f7f9 in gtk_tree_view_get_type () from
/usr/lib/libgtk-x11-2.0.so.0
#6  0x4144d6d4 in gtk_propagate_event () from
/usr/lib/libgtk-x11-2.0.so.0
#7  0x416b53f2 in g_type_class_meta_marshal (closure=0x8115830,
return_value=0xbfffd910, n_param_values=2, param_values=0xbfffdaa0, 
    invocation_hint=0xbfffd948, marshal_data=0xc8) at gclosure.c:514
#8  0x416b5136 in g_closure_invoke (closure=0x8115830,
return_value=0xbfffd910, n_param_values=2, param_values=0xbfffdaa0, 
    invocation_hint=0xbfffd948) at gclosure.c:437
-- 
-----------------------------------------------------
http://witme.sourceforge.net/libferris.web/




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