path: root/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
diff options
authorMårten Nordheim <>2019-08-13 15:17:40 +0200
committerMårten Nordheim <>2019-08-23 23:13:08 +0000
commit2ed7831ff636f4fbaec27524d416d63c2fd773bf (patch)
treee3e8dba99ec84d4781cf9b9740a27910c12cd65d /tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
parent8f9120d4808ce1fca6ae0dcda66e48d4d09350bb (diff)
DBus: fix deadlock when destroying QDBusServer
Observed infrequently in the QDBus tests, it would deadlock when destroying QDBusServer at the same time as qDBusNewConnection was being executed as they were locking the same locks, but in opposite order. QDBusServer locks d->lock, then QDBusConnectionManager::instance()->mutex. While qDBusNewConnection locks QDBusConnectionManager::instance()->mutex, then serverConnection->lock (and serverConnection here is QDBusServer's d-pointer). QOrderedMutexLocker cannot be used in this situation because it operates on QMutex*, which d->lock (QReadWriteLock) is not. Change the code to lock QDBusConnectionManager's mutex before d->lock and then unlock the QMutexLocker where it would previously destruct. If QDBusConnectionManager has already been destroyed then we pass a nullptr to the QMutexLocker which is fine and will not do anything. Fixes: QTBUG-74635 Change-Id: I7f02d7759da67377996ef042c81b0969ccb8aadb Reviewed-by: Marc Mutz <> Reviewed-by: Edward Welbourne <> (cherry picked from commit 6d3a4546934827955f0eb2b07a9928f82790ba37)
Diffstat (limited to 'tests/auto/corelib/tools/qlocale/tst_qlocale.cpp')
0 files changed, 0 insertions, 0 deletions