From c87c2b0544aea0f80d07eaaae2712accd484511e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 5 Apr 2022 11:37:17 -0700 Subject: QObjectPrivate:Connection:: use NSDMI for the ref count Can't use it for the bit in the bit field until C++20. Change-Id: If2e0f4b2190341ebaa31fffd16e313f64d52c26a Reviewed-by: Marc Mutz --- src/corelib/kernel/qobject.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 78394b8649..af87c7d0e3 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -131,7 +131,7 @@ struct QObjectPrivate::Connection : public ConnectionOrSignalVector QtPrivate::QSlotObjectBase *slotObj; }; QAtomicPointer argumentTypes; - QAtomicInt ref_; + QAtomicInt ref_{2}; //ref_ is 2 for the use in the internal lists, and for the use in QMetaObject::Connection uint id = 0; ushort method_offset; ushort method_relative; @@ -140,9 +140,7 @@ struct QObjectPrivate::Connection : public ConnectionOrSignalVector ushort isSlotObject : 1; ushort ownArgumentTypes : 1; ushort isSingleShot : 1; - Connection() : ref_(2), ownArgumentTypes(true) { - //ref_ is 2 for the use in the internal lists, and for the use in QMetaObject::Connection - } + Connection() : ownArgumentTypes(true) { } ~Connection(); int method() const { Q_ASSERT(!isSlotObject); return method_offset + method_relative; } void ref() { ref_.ref(); } -- cgit v1.2.1