[gtk+] Ensure we initialize a quark first



commit cb8817f710f0fa5cade175238e72fe3f3d43aa85
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 6 00:46:17 2016 -0400

    Ensure we initialize a quark first
    
    The style function here can also be called before the corresponding
    class_init had a chance to create the quark. Fix this.

 gtk/deprecated/gtkstyle.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/deprecated/gtkstyle.c b/gtk/deprecated/gtkstyle.c
index 664330d..7bef213 100644
--- a/gtk/deprecated/gtkstyle.c
+++ b/gtk/deprecated/gtkstyle.c
@@ -509,8 +509,6 @@ gtk_style_class_init (GtkStyleClass *klass)
                                   NULL, NULL,
                                   _gtk_marshal_VOID__VOID,
                                   G_TYPE_NONE, 0);
-
-  quark_default_style = g_quark_from_static_string ("gtk-legacy-default-style");
 }
 
 static void
@@ -4019,6 +4017,9 @@ gtk_widget_get_default_style_for_screen (GdkScreen *screen)
 {
   GtkStyle *default_style;
 
+  if G_UNLIKELY (quark_default_style == 0)
+    quark_default_style = g_quark_from_static_string ("gtk-legacy-default-style");
+
   default_style = g_object_get_qdata (G_OBJECT (screen), quark_default_style);
   if (default_style == NULL)
     {


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