[gjs/gnome-3-30] object: add reference to the property pspec we cache



commit 0f77ebd6ccb96ef209a8d4bdbeec6d362fb28254
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 9 05:49:21 2018 +0200

    object: add reference to the property pspec we cache
    
    When caching the properties param specs we get them from the class object, which
    is currently owning them, however since we're caching them we should add a
    reference to them in order to keep the ownership and clean them up properly
    when the cache is destroyed
    
    Fixes GNOME/gjs#213

 gi/object.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 8ef7b1ab..242abfae 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -287,7 +287,8 @@ GParamSpec* ObjectPrototype::find_param_spec_from_id(JSContext* cx,
 
     gname = gjs_hyphen_from_camel(js_prop_name);
     GObjectClass *gobj_class = G_OBJECT_CLASS(g_type_class_ref(m_gtype));
-    GjsAutoParam param_spec = g_object_class_find_property(gobj_class, gname);
+    GParamSpec* pspec = g_object_class_find_property(gobj_class, gname);
+    GjsAutoParam param_spec(pspec, GjsAutoParam::TakeOwnership());
     g_type_class_unref(gobj_class);
     g_free(gname);
 


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