gtk2 + threads = hang



Hi list,
Perhaps someone can help me, I am a newbie at GTK.

I am hacking on a GTK2 application that used to be single threaded.
Now I have added a new low-prio thread to do some background updates
to this application.


The main application (main thread) creates a window with a table on it with
lots of
text labels on it.
Some time after this window and all the widgets have been created, by the
main thread, the
background thread will try to do some gtk_label_set_text() calls to change
the text
for a few of these labels.

However, for the very first gtk_label_set_text() that the thread tries, the
entire application will
hang.
When the application hangs it first prints a 'A' character to stdout and if
I input something to stdin, or just press return, then the application
continues and all further gtk_label_set_text()
calls works fine.

Sometimes when I get the app to unpause in that way I get :
(xxx:7768): Gtk-CRITICAL **: file gtkwidget.c: line 2927 (gtk_widget_event):
assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

I guess that means I've done something bad.

Does anyone know what the problem might be? Why I cant do
gtk_label_set_text() from the low-prio background thread on label-widgets i
created from the main thread?


Do i need to do something special if i use low-prio threads and if I mess
with widgets from it?


I run linux rh7.2 and i have installed glib2 and gtk2





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