diff options
author | portix <none@none> | 2012-06-06 12:36:41 +0200 |
---|---|---|
committer | portix <none@none> | 2012-06-06 12:36:41 +0200 |
commit | 7140d809df867baa25d97d7c6cd88e99dd22fc6a (patch) | |
tree | 72bf9d8de48d2dd01c21e9a3063da1780cfa189f /src | |
parent | e886b613364ea7cb5a67701853ee07aa2bac619e (diff) | |
download | dwb-7140d809df867baa25d97d7c6cd88e99dd22fc6a.zip |
GObject class check in set_property/get_property
Diffstat (limited to 'src')
-rw-r--r-- | src/scripts.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/scripts.c b/src/scripts.c index 1df4f709..06775bc6 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -1291,8 +1291,14 @@ set_property(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueR uncamelize(buf, name, '-', PROP_LENGTH); g_free(name); - GObject *o = JSObjectGetPrivate(object); + io.pr + void *p = JSObjectGetPrivate(object); + if (p == NULL) + return false; + GObject *o = G_OBJECT(p); GObjectClass *class = G_OBJECT_GET_CLASS(o); + if (class == NULL || !G_IS_OBJECT_CLASS(class)) + return NULL; GParamSpec *pspec = g_object_class_find_property(class, buf); if (pspec == NULL) @@ -1339,8 +1345,13 @@ get_property(JSContextRef ctx, JSObjectRef jsobj, JSStringRef js_name, JSValueRe uncamelize(buf, name, '-', PROP_LENGTH); g_free(name); - GObject *o = JSObjectGetPrivate(jsobj); + void *p = JSObjectGetPrivate(jsobj); + if (p == NULL) + return NULL; + GObject *o = G_OBJECT(p); GObjectClass *class = G_OBJECT_GET_CLASS(o); + if (class == NULL || !G_IS_OBJECT_CLASS(class)) + return NULL; GParamSpec *pspec = g_object_class_find_property(class, buf); if (pspec == NULL) return NULL; |