summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp')
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 65709e3afa..1c9818696e 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -207,8 +207,8 @@ void tst_QSharedPointer::basics()
QVERIFY(! (ptr == otherData));
QVERIFY(! (otherData == ptr));
}
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1);
{
// create another object:
@@ -220,8 +220,8 @@ void tst_QSharedPointer::basics()
// otherData is deleted here
}
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1);
{
// create a copy:
@@ -237,8 +237,8 @@ void tst_QSharedPointer::basics()
QCOMPARE(copy.data(), aData);
QVERIFY(copy == aData);
}
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1);
{
// create a weak reference:
@@ -269,8 +269,8 @@ void tst_QSharedPointer::basics()
QVERIFY(strong == ptr);
QCOMPARE(strong.data(), aData);
}
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref == 1);
- QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1);
+ QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1);
// aData is deleted here
}
@@ -555,15 +555,15 @@ void tst_QSharedPointer::upCast()
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QWeakPointer<DerivedData> derivedptr = qWeakPointerCast<DerivedData>(baseptr);
QVERIFY(baseptr == derivedptr);
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -571,16 +571,16 @@ void tst_QSharedPointer::upCast()
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.staticCast<DerivedData>();
QVERIFY(baseptr == derivedptr);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
}
class OtherObject: public QObject
@@ -955,8 +955,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -965,8 +965,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.dynamicCast<DerivedData>();
@@ -974,8 +974,8 @@ void tst_QSharedPointer::dynamicCast()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
}
void tst_QSharedPointer::dynamicCastDifferentPointers()
@@ -990,8 +990,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -1000,8 +1000,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QSharedPointer<DiffPtrDerivedData> derivedptr = baseptr.dynamicCast<DiffPtrDerivedData>();
@@ -1009,8 +1009,8 @@ void tst_QSharedPointer::dynamicCastDifferentPointers()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
Stuffing *nakedptr = dynamic_cast<Stuffing *>(baseptr.data());
@@ -1035,8 +1035,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QWeakPointer<Data> weakptr = baseptr;
@@ -1045,8 +1045,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QSharedPointer<VirtualDerived> derivedptr = baseptr.dynamicCast<VirtualDerived>();
@@ -1054,8 +1054,8 @@ void tst_QSharedPointer::dynamicCastVirtualBase()
QCOMPARE(derivedptr.data(), aData);
QCOMPARE(static_cast<Data *>(derivedptr.data()), baseptr.data());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
}
void tst_QSharedPointer::dynamicCastFailure()
@@ -1067,15 +1067,15 @@ void tst_QSharedPointer::dynamicCastFailure()
QSharedPointer<DerivedData> derivedptr = qSharedPointerDynamicCast<DerivedData>(baseptr);
QVERIFY(derivedptr.isNull());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
{
QSharedPointer<DerivedData> derivedptr = baseptr.dynamicCast<DerivedData>();
QVERIFY(derivedptr.isNull());
}
- QCOMPARE(int(refCountData(baseptr)->weakref), 1);
- QCOMPARE(int(refCountData(baseptr)->strongref), 1);
+ QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
+ QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
}
#endif
@@ -1371,8 +1371,8 @@ void tst_QSharedPointer::creating()
QCOMPARE(Data::destructorCounter, 1);
// valgrind will complain here if something happened to the pointer
- QVERIFY(d->weakref == 1);
- QVERIFY(d->strongref == 0);
+ QVERIFY(d->weakref.load() == 1);
+ QVERIFY(d->strongref.load() == 0);
}
check();