mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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:
parent
331e15b128
commit
02877e2902
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user