[gtk/wip/otte/listview: 20/152] expression: Don't rely on peeking



commit bb06efb477ba7807f330467da226165b8322778a
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Nov 28 14:25:41 2019 -0500

    expression: Don't rely on peeking
    
    There is no guarantee that somebody else has refed
    the class yet, so do it here. This was causing test
    failures, when running single tests that happen to
    call this function early on.

 gtk/gtkexpression.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkexpression.c b/gtk/gtkexpression.c
index fc9ed3d632..f298354e30 100644
--- a/gtk/gtkexpression.c
+++ b/gtk/gtkexpression.c
@@ -616,11 +616,15 @@ gtk_property_expression_new (GType          this_type,
 
   if (g_type_is_a (this_type, G_TYPE_OBJECT))
     {
-      pspec = g_object_class_find_property (g_type_class_peek (this_type), property_name);
+      GObjectClass *class = g_type_class_ref (this_type);
+      pspec = g_object_class_find_property (class, property_name);
+      g_type_class_unref (class);
     }
   else if (g_type_is_a (this_type, G_TYPE_INTERFACE))
     {
-      pspec = g_object_interface_find_property (g_type_default_interface_peek (this_type), property_name);
+      GTypeInterface *iface = g_type_default_interface_ref (this_type);
+      pspec = g_object_interface_find_property (iface, property_name);
+      g_type_default_interface_unref (iface);
     }
   else
     {


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