GNOME Bugzilla – Bug 641429
Errors creating a GtkWidget without a display
Last modified: 2011-02-08 02:23:56 UTC
Gtk-CRITICAL **: gtk_style_context_set_screen: assertion `GDK_IS_SCREEN (screen)' failed
+ Trace 225837
This used to work in GTK+ 2.x, even if it was a slight abuse of GTK+.
The fix for this (4dc9b294d8a5bd822828964930b834f4b8999cff) triggers a gazillion warnings in GIMP which go away if I revert the patch.
The actual problem seems to be that the fix causes an inconsistent state where gtk_widget_get_screen() (which many places check) returns the non-NULL default screen, while gtk_style_context_get_screen() (which is called by the functions called inside above check) returns a NULL screen. This happens e.g. if I call gtk_entry_set_icon_from_stock() on an unrealized widget, which is a completely normal thing to do.
I have reverted part of this that cased warnings in gtk-demo. Are you still seeing problems ?