summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsharedpointer.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-11-05 19:06:47 +0100
committerLiang Qi <liang.qi@qt.io>2018-11-05 19:06:47 +0100
commiteedb3a06cbaff1a3e100a0d68a578d15a0c9dd97 (patch)
treecc9c2677b63d99f87dfd60d7eb0aba138c026d06 /src/corelib/tools/qsharedpointer.cpp
parent73e7eb785fbf984e2b964be8c3acad788479dfa6 (diff)
parentd24835a60c0c620a27c7a9830b89ed47312739a5 (diff)
Merge remote-tracking branch 'origin/5.12.0' into 5.12
Diffstat (limited to 'src/corelib/tools/qsharedpointer.cpp')
-rw-r--r--src/corelib/tools/qsharedpointer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index e58d3ab6bc..622b03f42d 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -1384,6 +1384,9 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
x->strongref.store(-1);
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
if (!d->sharedRefcount.testAndSetRelease(0, x)) {
+ // ~ExternalRefCountData has a Q_ASSERT, so we use this trick to
+ // only execute this if Q_ASSERTs are enabled
+ Q_ASSERT((x->weakref.store(0), true));
delete x;
x = d->sharedRefcount.loadAcquire();
x->weakref.ref();