Re: [gtkmm] Problem udating a treeView



Am Fr, den 18.06.2004 um 9:35 Uhr +0200 schrieb DESCOMBES Thierry:
> Hi
> I'm a newbee with Gtkmm2.4 and I have to use a treeView to show
> informations. I have found a way to update it, when the datas change: I
> called a function doing:
> 
>    pthread_mutex_lock(&p_mut);
>    m_refTreeModel->clear();
>    load_connected_sensor_treeview_model(); // rebuilt the treeview_model
>    pthread_mutex_unlock(&p_mut);
> 
> But when this function is called with a too high frequency, my
> application crashes: Most of time with a segmentation fault, and
> sometimes with the message:
> GLib-GObject-ERROR **: file gsignal.c: line 655 (emission_pop): should
> not be reached
> aborting...
> Aborted

No wonder, considering that you access GTK+ stuff from multiple threads,
apparently.  You might get away with calling Glib::thread_init() first
thing in main(), and using gdk_threads_enter()/gdk_threads_leave() to
guard any access to the GUI.  However, a much better approach is to have
a single GUI thread and use Glib::Dispatcher to notify the GUI thread.
See the glibmm reference documentation for more information and some
examples.

--Daniel





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