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
This commit is contained in:
Matthias Clasen 2016-01-30 16:06:59 -05:00
parent 3b4aad7d26
commit bbe48d0624

View File

@ -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,