gobject: Warn if someone uses the wrong property in g_object_get/set

"Interface::property" was not detected before and led to a crash.
This commit is contained in:
Benjamin Otte 2011-05-02 19:22:25 +02:00
parent 331e15b128
commit 02877e2902

View File

@ -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;