[gjs] util: Correct the create_proto functions created by DEFINE_PROTO
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] util: Correct the create_proto functions created by DEFINE_PROTO
- Date: Thu, 26 Jan 2012 15:07:00 +0000 (UTC)
commit 97f0be7db9674a13630b73d4d4412d228a37322c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 19 22:23:44 2012 -0500
util: Correct the create_proto functions created by DEFINE_PROTO
Before, the code was checking to see if the class existed, but didn't
return the correct value in the case that the class *did* exist.
https://bugzilla.gnome.org/show_bug.cgi?id=668427
gjs/jsapi-util.h | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index bd3c5fe..0e186f9 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -162,8 +162,8 @@ jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, const cha
{ \
jsval rval; \
JSObject *global = gjs_get_import_global(context); \
- if (!gjs_object_has_property(context, global, \
- gjs_##cname##_class.name)) { \
+ if (!gjs_object_get_property(context, global, \
+ gjs_##cname##_class.name, &rval)) { \
JSObject *prototype = JS_InitClass(context, global, \
parent, \
&gjs_##cname##_class, \
@@ -181,10 +181,10 @@ jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, const cha
gjs_##cname##_class.name, &rval)) { \
return JSVAL_NULL; \
} \
+ if (!JS_DefineProperty(context, module, proto_name, \
+ rval, NULL, NULL, GJS_MODULE_PROP_FLAGS)) \
+ return JS_FALSE; \
} \
- if (!JS_DefineProperty(context, module, proto_name, \
- rval, NULL, NULL, GJS_MODULE_PROP_FLAGS)) \
- return JS_FALSE; \
return rval; \
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]