From 02877e29020c2a0f34283435ecf544b1f6793077 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 2 May 2011 19:22:25 +0200 Subject: [PATCH] gobject: Warn if someone uses the wrong property in g_object_get/set "Interface::property" was not detected before and led to a crash. --- gobject/gobject.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gobject/gobject.c b/gobject/gobject.c index 7fa845f..ead9071 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1124,6 +1124,13 @@ object_get_property (GObject *object, guint param_id = PARAM_SPEC_PARAM_ID (pspec); GParamSpec *redirect; + if (class == NULL) + { + g_warning ("'%s::%s' is not a valid property name; '%s' is not a GObject subtype", + g_type_name (pspec->owner_type), pspec->name, g_type_name (pspec->owner_type)); + return; + } + redirect = g_param_spec_get_redirect_target (pspec); if (redirect) pspec = redirect; @@ -1143,6 +1150,13 @@ object_set_property (GObject *object, GParamSpec *redirect; static gchar* enable_diagnostic = NULL; + if (class == NULL) + { + g_warning ("'%s::%s' is not a valid property name; '%s' is not a GObject subtype", + g_type_name (pspec->owner_type), pspec->name, g_type_name (pspec->owner_type)); + return; + } + redirect = g_param_spec_get_redirect_target (pspec); if (redirect) pspec = redirect; -- 2.7.4