[gtk/matthiasc/expression] expression: Don't rely on peeking
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/expression] expression: Don't rely on peeking
- Date: Thu, 28 Nov 2019 19:41:41 +0000 (UTC)
commit 3dbed5e6081ec485c562c84a20e206a8c7170d6f
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 c80e6f60f1..a77d159097 100644
--- a/gtk/gtkexpression.c
+++ b/gtk/gtkexpression.c
@@ -552,11 +552,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]