summaryrefslogtreecommitdiff
path: root/gtk/gtkstyle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-02-04 22:01:40 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-02-04 22:03:11 -0500
commit4dc9b294d8a5bd822828964930b834f4b8999cff (patch)
tree9ed3baf42480da9c0ea99545273fbe6e67826f8a /gtk/gtkstyle.c
parent2b2e6074925d875133c6e3294de34e3f84fbf694 (diff)
downloadgtk+-4dc9b294d8a5bd822828964930b834f4b8999cff.tar.gz
Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r--gtk/gtkstyle.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 81105d81db..5347119ef0 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -813,13 +813,15 @@ gtk_style_copy (GtkStyle *style)
GtkStyle*
_gtk_style_new_for_path (GdkScreen *screen,
- GtkWidgetPath *path)
+ GtkWidgetPath *path)
{
GtkStyleContext *context;
GtkStyle *style;
context = gtk_style_context_new ();
- gtk_style_context_set_screen (context, screen);
+
+ if (screen)
+ gtk_style_context_set_screen (context, screen);
gtk_style_context_set_path (context, path);
style = g_object_new (GTK_TYPE_STYLE,
@@ -848,8 +850,7 @@ gtk_style_new (void)
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
- style = _gtk_style_new_for_path (gdk_screen_get_default (),
- path);
+ style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
gtk_widget_path_free (path);