summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-04-05 11:37:17 -0700
committerThiago Macieira <thiago.macieira@intel.com>2022-04-13 20:17:38 -0700
commitc87c2b0544aea0f80d07eaaae2712accd484511e (patch)
tree4a5d7df2973876f8964247b34a14c56a49944330 /src
parent06c2478762fafd16190259975bf381f14ad410e9 (diff)
downloadqtbase-c87c2b0544aea0f80d07eaaae2712accd484511e.tar.gz
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 <marc.mutz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp6
1 files changed, 2 insertions, 4 deletions
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<const int> 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(); }