[gtk+] Throw an error when a display is missing



commit bbe48d06246ce208ce4d0e00aef45180b7c71dbd
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 30 16:06:59 2016 -0500

    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 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index ae47e8b..7d5664a 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]