Threads and gtk_widget_show (code should not be reached?)



I have encountered a strange error followed by a crash when I add the following object to a GtkTextView by 
creating a child anchor and call gtk_widget_show_all.

The object that is added

The object that is added to the child anchor is a GtkFrame inside which is a GtkTable and each cell of the 
table contains another GtkFrame each of which contains a GtkTextView.

The error

This works fine if it is all done from the main program. However, when I create the hierarchy described above 
in another thread and call gtk_widget_show_all on the GtkFrame that is added, I get an error in paint saying 
code should not be reached. Before this error, there is a warning that the iterator in text view has changed. 
I am not sure if the warning and error are related.

Source of the error

I replaced gtk_widget_show_all by gtk_widget_show in a loop going down the tree and calling it for each 
object. The source of the error was the gtk_widget_show on the leaf level view objects in the frames 
contained in each cell of the table.

Situations under which it works

When the leaf level GtkTextView objects are not part of the hierarchy of widgets I create or they are 
replaced by GtkEntry objects, everything works fine. Again, note that it also works fine if I do not have 
another thread and call everything from the main program on startup but I need to have another thread as this 
object will be created during the course of the program. I've tried both g_idle_add as well as using the 
gdk_threads_enter/leave pair.

Any help will be appreciated.

-Ferdinand



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