diff options
Diffstat (limited to 'src/corelib/thread/qmutex.h')
-rw-r--r-- | src/corelib/thread/qmutex.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 22da73a8b8..4fe4df09c6 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -116,8 +116,11 @@ public: Q_ASSERT_X((reinterpret_cast<quintptr>(m) & quintptr(1u)) == quintptr(0), "QMutexLocker", "QMutex pointer is misaligned"); val = quintptr(m); - // relock() here ensures that we call QMutex::lock() instead of QBasicMutex::lock() - relock(); + if (Q_LIKELY(m)) { + // call QMutex::lock() instead of QBasicMutex::lock() + static_cast<QMutex *>(m)->lock(); + val |= 1; + } } inline ~QMutexLocker() { unlock(); } |