[gjs] object: Make sure that we properly add a ref to custom objects



commit abeb99b8930dfa24322d77d3bfc815213b3ae76c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Feb 8 16:19:16 2012 -0500

    object: Make sure that we properly add a ref to custom objects
    
    Since we initialize custom GObjects through construct properties, we need to
    make sure that we don't get fooled and think that g_object_newv returned
    a singleton.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669709

 gi/object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index 94185f6..2c4bad6 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -934,7 +934,7 @@ object_instance_init (JSContext *context,
     free_g_params(params, n_params);
 
     old_jsobj = peek_js_obj(context, gobj);
-    if (old_jsobj != NULL) {
+    if (old_jsobj != NULL && old_jsobj != *object) {
         /* g_object_newv returned an object that's already tracked by a JS
          * object. Let's assume this is a singleton like IBus.IBus and return
          * the existing JS wrapper object.



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