diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-10-25 16:32:13 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-10-29 19:12:17 +0000 |
commit | 3b8075de3b3c842311c157476a85d2cf9ddff403 (patch) | |
tree | 49b0dc3113a9dfbb0fe11acd4562893a33b39fd9 /src/gui/opengl/qopenglvertexarrayobject.cpp | |
parent | d4e937a6280f34bc1cce8c8cea3806a741312fbc (diff) |
Fix deleting of QSharedPointer internals in case QPointer loses the race
QPointer uses QWeakPointer / QSharedPointer internals in QObject and has
the code to make sure two threads won't stomp on each other if both try
to create a QPointer for the same QObject at the same time. The
threading code was fine, but had a mistake in the clean up code for the
loser thread: the QtSharedPointer::ExternalRefCountData destructor has a
Q_ASSERT for the state of the reference counts. So we need to set the
state correctly before calling the destructor.
But we don't want to do it in case the Q_ASSERT compiled to nothing. So
we use a hack that violates the Second Rule of Q_ASSERTs: don't do
something with side-effects. This way, we can insert code that will only
be compiled if Q_ASSERTs do something, without having to duplicate the
preprocessor conditions from qglobal.h.
Fixes: QTBUG-71412
Change-Id: I1bd327aeaf73421a8ec5fffd1560fdfc8b73b70c
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Diffstat (limited to 'src/gui/opengl/qopenglvertexarrayobject.cpp')
0 files changed, 0 insertions, 0 deletions