[gjs] object: typecheck the object passed to _init



commit 22cbe54ebb42cc19e60254af729f897336dce658
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Dec 19 01:38:28 2012 +0100

    object: typecheck the object passed to _init
    
    While unlikely and generally a programmer error, calling GObject.Object.prototype._init
    with a this argument that is not a GObject should not assert but only
    throw.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690688

 gi/object.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index 5857fdb..4a0e99e 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -1495,6 +1495,9 @@ init_func (JSContext *context,
     JSObject *obj = JS_THIS_OBJECT(context, vp);
     JSBool ret;
 
+    if (!do_base_typecheck(context, obj, TRUE))
+        return FALSE;
+
     ret = object_instance_init(context, &obj, argc, argv);
 
     if (ret)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]