[glib] gobject: Warn if someone uses the wrong property in g_object_get/set
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gobject: Warn if someone uses the wrong property in g_object_get/set
- Date: Mon, 2 May 2011 17:34:19 +0000 (UTC)
commit 02877e29020c2a0f34283435ecf544b1f6793077
Author: Benjamin Otte <otte redhat com>
Date: Mon May 2 19:22:25 2011 +0200
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 files changed, 14 insertions(+), 0 deletions(-)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]