QThread: avoid lock/relock an empty QMutexLocker
These semantics are deprecated and about to be changed. Drive by, use nullptr instead of 0. Change-Id: I213bf7d528d2fa312549f9fa49a5533198eddf88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
979ee48ca1
commit
e0a7364b50
|
|
@ -334,23 +334,27 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) noexcept
|
|||
QThread *thr = reinterpret_cast<QThread *>(arg);
|
||||
QThreadPrivate *d = thr->d_func();
|
||||
|
||||
QMutexLocker locker(lockAnyway ? &d->mutex : 0);
|
||||
QMutexLocker locker(lockAnyway ? &d->mutex : nullptr);
|
||||
d->isInFinish = true;
|
||||
d->priority = QThread::InheritPriority;
|
||||
void **tls_data = reinterpret_cast<void **>(&d->data->tls);
|
||||
locker.unlock();
|
||||
if (lockAnyway)
|
||||
locker.unlock();
|
||||
emit thr->finished(QThread::QPrivateSignal());
|
||||
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
|
||||
QThreadStorageData::finish(tls_data);
|
||||
locker.relock();
|
||||
if (lockAnyway)
|
||||
locker.relock();
|
||||
|
||||
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed();
|
||||
if (eventDispatcher) {
|
||||
d->data->eventDispatcher = 0;
|
||||
locker.unlock();
|
||||
if (lockAnyway)
|
||||
locker.unlock();
|
||||
eventDispatcher->closingDown();
|
||||
delete eventDispatcher;
|
||||
locker.relock();
|
||||
if (lockAnyway)
|
||||
locker.relock();
|
||||
}
|
||||
|
||||
d->running = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue