[gjs/gnome-42] 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/gnome-42] arg-cache: Make explicit when BaseInfo is adding a reference
- Date: Sun, 3 Jul 2022 23:11:17 +0000 (UTC)
commit 954186bdcfd0603085932e4909d80909ec118f44
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 f17062676..f4c89b651 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -226,8 +226,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;
};
@@ -251,7 +252,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; }
@@ -260,7 +262,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 &&
@@ -554,7 +557,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]