summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2025-07-09 11:43:56 -0700
committerThiago Macieira <thiago.macieira@intel.com>2025-07-10 14:08:13 -0700
commit858ac29d6747d9013b9e5aeb056b54c47e980329 (patch)
tree37885d197ddf68ab7dc26186d576311f3d00f0db
parentf08f2b4a98e9a3199b896eed61b754d86b984810 (diff)
Revert renaming of QArrayData::ref_
This reverts part of commit 3f61f736266ece40d627dcf6214618a22a009fd1. The renaming of the member caused Qt Creator to break. Since that was a gratuitous change and was backported, it's hard to fix. src/libs/utils/stringtable.cpp:97:44: error: ‘QArrayDataPointer<char16_t>::Data’ {aka ‘struct QTypedArrayData<char16_t>’} has no member named ‘ref_’; did you mean ‘ref’? Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I5d0b1a0c9b42adc38c7bfffd1a86e7abb08d952b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
-rw-r--r--src/corelib/tools/qarraydata.h10
-rw-r--r--src/corelib/tools/qarraydataops.h4
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp12
3 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 71e183e646e..38d1091ac1f 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -39,7 +39,7 @@ struct QArrayData
};
Q_DECLARE_FLAGS(ArrayOptions, ArrayOption)
- QBasicAtomicInt m_ref;
+ QBasicAtomicInt ref_;
ArrayOptions flags;
qsizetype alloc;
@@ -56,19 +56,19 @@ struct QArrayData
/// Returns true if sharing took place
bool ref() noexcept
{
- m_ref.ref();
+ ref_.ref();
return true;
}
/// Returns false if deallocation is necessary
bool deref() noexcept
{
- return m_ref.deref();
+ return ref_.deref();
}
bool isShared() const noexcept
{
- return m_ref.loadRelaxed() != 1;
+ return ref_.loadRelaxed() != 1;
}
// Returns true if a detach is necessary before modifying the data
@@ -76,7 +76,7 @@ struct QArrayData
// detaching is necessary, you should be in a non-const function already
bool needsDetach() noexcept
{
- return m_ref.loadRelaxed() > 1;
+ return ref_.loadRelaxed() > 1;
}
qsizetype detachCapacity(qsizetype newSize) const noexcept
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index 419585b0260..c20abd12c23 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -82,7 +82,7 @@ public:
void destroyAll() noexcept // Call from destructors, ONLY!
{
Q_ASSERT(this->d);
- Q_ASSERT(this->d->m_ref.loadRelaxed() == 0);
+ Q_ASSERT(this->d->ref_.loadRelaxed() == 0);
// As this is to be called only from destructor, it doesn't need to be
// exception safe; size not updated.
@@ -345,7 +345,7 @@ public:
// As this is to be called only from destructor, it doesn't need to be
// exception safe; size not updated.
- Q_ASSERT(this->d->m_ref.loadRelaxed() == 0);
+ Q_ASSERT(this->d->ref_.loadRelaxed() == 0);
std::destroy(this->begin(), this->end());
}
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 87d48d56e6b..5804aeeb1e5 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -73,22 +73,22 @@ void tst_QArrayData::referenceCounting()
// Reference counting initialized to 1 (owned)
QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(1), {}, 0 };
- QCOMPARE(array.m_ref.loadRelaxed(), 1);
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
QVERIFY(array.ref());
- QCOMPARE(array.m_ref.loadRelaxed(), 2);
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
QVERIFY(array.deref());
- QCOMPARE(array.m_ref.loadRelaxed(), 1);
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
QVERIFY(array.ref());
- QCOMPARE(array.m_ref.loadRelaxed(), 2);
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
QVERIFY(array.deref());
- QCOMPARE(array.m_ref.loadRelaxed(), 1);
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
QVERIFY(!array.deref());
- QCOMPARE(array.m_ref.loadRelaxed(), 0);
+ QCOMPARE(array.ref_.loadRelaxed(), 0);
// Now would be a good time to free/release allocated data
}