summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorJani Heikkinen <jani.heikkinen@qt.io>2018-11-05 12:49:22 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-11-05 12:49:22 +0000
commitd24835a60c0c620a27c7a9830b89ed47312739a5 (patch)
tree5bd2d865c2f1c93246b1d19a631f1a9581513d0e /src/corelib/tools
parent60197af4850e13409f26551ce812e866602e6926 (diff)
parentb36c5bdc30040b5100da2a003056d3519972e178 (diff)
Merge "Merge remote-tracking branch 'origin/5.11' into 5.12.0" into refs/staging/5.12.0v5.12.0-beta4
Diffstat (limited to 'src/corelib/tools')
-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();