The current method for calling gtk_xx instructions is from the main thread
only (i.e., that which owns the main loop context). You can do this by
means of g_main_context_invoke(). Otherwise you must use the deprecated
gdk_threads_enter/gdk_threads_leave mutex method. The deprecated method is
slower.

If you do not do the above, you will get all sort of errors just like the
one you describe.

HTH

2013/1/30 Ferdinand Ramirez <ramirez.ferdin...@yahoo.com>

> 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
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to