[seed] libseed: Pass this as an argument to constructors in addition to as this. Calling it self provides a
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] libseed: Pass this as an argument to constructors in addition to as this. Calling it self provides a
- Date: Sun, 24 May 2009 17:43:11 -0400 (EDT)
commit e7e80ea703391d970230b210f6298b2f3989644e
Author: Robert Carr <racarr svn gnome org>
Date: Sat May 23 20:21:34 2009 -0400
libseed: Pass this as an argument to constructors in addition to as this. Calling it self provides a quick solution to capturing this in closures.
---
libseed/seed-gtype.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libseed/seed-gtype.c b/libseed/seed-gtype.c
index 0a6c673..02760d5 100644
--- a/libseed/seed-gtype.c
+++ b/libseed/seed-gtype.c
@@ -297,7 +297,7 @@ seed_gtype_construct (GType type,
{
JSContextRef ctx;
JSObjectRef func, this_object;
- JSValueRef exception = NULL;
+ JSValueRef exception = NULL, args[1];
GObject *object;
GType parent;
GObjectClass *parent_class;
@@ -318,8 +318,9 @@ seed_gtype_construct (GType type,
SEED_NOTE (GTYPE, "Handling constructor for: %p with type: %s",
object, g_type_name (type));
this_object = (JSObjectRef) seed_value_from_object (ctx, object, NULL);
+ args[0] = this_object;
- JSObjectCallAsFunction (ctx, func, this_object, 0, 0, &exception);
+ JSObjectCallAsFunction (ctx, func, this_object, 1, args, &exception);
if (exception)
{
gchar *mes = seed_exception_to_string (ctx, exception);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]