From bbe48d06246ce208ce4d0e00aef45180b7c71dbd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 30 Jan 2016 16:06:59 -0500 Subject: [PATCH] Throw an error when a display is missing Creating style context won't work without a display, so give a clear error message and abort instead of segfaulting later on. https://bugzilla.gnome.org/show_bug.cgi?id=761332 --- gtk/gtkstylecontext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index ae47e8b315..7d5664af80 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -330,6 +330,9 @@ gtk_style_context_init (GtkStyleContext *context) priv->screen = gdk_screen_get_default (); + if (priv->screen == NULL) + g_error ("Can't create a GtkStyleContext without a display connection"); + priv->property_cache = g_array_new (FALSE, FALSE, sizeof (PropertyValue)); gtk_style_context_set_cascade (context,