[gjs: 2/8] object: add reference to the property pspec we cache
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/8] object: add reference to the property pspec we cache
- Date: Wed, 10 Oct 2018 05:44:00 +0000 (UTC)
commit c9d04066b4fb08947c3412cd2b6d73291de4265c
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 eb5988d2..93fa06cf 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]