How to force the refresh of a GTKTreeView in a multithreaded app?
- From: Álvaro Palma <apalma opschile cl>
- To: gtk-list gnome org
- Subject: How to force the refresh of a GTKTreeView in a multithreaded app?
- Date: Thu, 21 Jun 2007 18:30:03 -0400
I've developed a very simple application in GTK2. This application
receives events from a socket and based on them, updates the values in a
The problem that arises is that the items displayed in the TreeView are
not updated until I move the mouse.
The application is something like this:
gtk_init (&argc, &argv);
// Create the window Widget
createThread(SocketEvents); // NOTICE THIS, A NEW THREAD IS CREATED
// TO UPDATE THE GUI
and inside the SocketEvents thread function, I update the GTKListStore
associated to the GTKTreeView with no luck. The code looks like this:
<receive an event from a socket>
while (gtk_events_pending ())
However, in this case, I receive the following error:
(MyAPP:12142): GLib-WARNING **: g_main_context_prepare(): main loop
already active in another thread
Xlib: unexpected async reply (sequence 0x1ee7)!
GLib-ERROR **: file gmain.c: line 1906 (g_main_dispatch): assertion
Can anybody give me a clue about how do I have to update the list store
to be able to see my changes reflected in the screen right away?
Thanks a lot for your attention and help.
] [Thread Prev