[gjs: 2/4] arg-cache: Make explicit when BaseInfo is adding a reference
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/4] arg-cache: Make explicit when BaseInfo is adding a reference
- Date: Sun, 3 Jul 2022 23:08:30 +0000 (UTC)
commit 40e5a4ca0f2a67a7da24d6902db1a4566c7dfa04
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Thu Jun 2 02:08:50 2022 +0200
arg-cache: Make explicit when BaseInfo is adding a reference
Just use GjsAutoTakeOwnership to be consistent with GjsAutoBaseInfo
object used under the hood.
gi/arg-cache.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gi/arg-cache.cpp b/gi/arg-cache.cpp
index 54a491c5e..bcf97b289 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -229,8 +229,9 @@ struct Array : BasicType {
};
struct BaseInfo {
- explicit BaseInfo(GIBaseInfo* info)
- : m_info(info ? g_base_info_ref(info) : nullptr) {}
+ explicit BaseInfo(GIBaseInfo* info, const GjsAutoTakeOwnership& add_ref)
+ : m_info(info, add_ref) {}
+ explicit BaseInfo(GIBaseInfo* info) : m_info(info) {}
GjsAutoBaseInfo m_info;
};
@@ -254,7 +255,8 @@ struct RegisteredType {
struct RegisteredInterface : BaseInfo {
explicit RegisteredInterface(GIBaseInfo* info)
- : BaseInfo(info), m_gtype(g_registered_type_info_get_g_type(m_info)) {}
+ : BaseInfo(info, GjsAutoTakeOwnership{}),
+ m_gtype(g_registered_type_info_get_g_type(m_info)) {}
constexpr GType gtype() const { return m_gtype; }
@@ -263,7 +265,8 @@ struct RegisteredInterface : BaseInfo {
struct Callback : Nullable, BaseInfo {
explicit Callback(GIInterfaceInfo* info)
- : BaseInfo(info), m_scope(GI_SCOPE_TYPE_INVALID) {}
+ : BaseInfo(info, GjsAutoTakeOwnership{}),
+ m_scope(GI_SCOPE_TYPE_INVALID) {}
inline void set_callback_destroy_pos(int pos) {
g_assert(pos <= Argument::MAX_ARGS &&
@@ -557,7 +560,7 @@ struct UnregisteredBoxedIn : BoxedIn, BaseInfo {
explicit UnregisteredBoxedIn(GIInterfaceInfo* info)
: BoxedIn(g_registered_type_info_get_g_type(info),
g_base_info_get_type(info)),
- BaseInfo(info) {}
+ BaseInfo(info, GjsAutoTakeOwnership{}) {}
// This is a smart argument, no release needed
GIBaseInfo* info() const override { return m_info; }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]