From fd785c3899d21dd05fd013336bbc63ce818dc2a6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 22 Aug 2019 10:17:12 +0200 Subject: QtCore: port all QMutexLocker users to qt_{scoped,unique}_lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... except four instances in QCoreApplication that would conflict with another change. Replace a locally-defined MutexUnlocker with a call to unlock() + qScopedGuard'ed lock() to avoid having to spell out the locker type while we can't depend on C++17 CTAD, yet. In QSettings, move the new mutex locker into and out of initDefaultPaths(), such as is idiomatic for std::unique_lock, but wasn't possible with QMutexLocker (which is not movable). Change-Id: I23056e13ecaa76159db583c7dccc6e05715e0788 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/kernel/qcoreapplication_win.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qcoreapplication_win.cpp') diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 822b68cf62..961b96710e 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -47,6 +47,7 @@ #ifndef QT_NO_QOBJECT #include "qmutex.h" #include +#include #endif #include "qtextstream.h" #include @@ -919,7 +920,7 @@ void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerI { QThreadData *data = object->d_func()->threadData; - QMutexLocker locker(&data->postEventList.mutex); + const auto locker = qt_scoped_lock(data->postEventList.mutex); if (data->postEventList.size() == 0) return; for (int i = 0; i < data->postEventList.size(); ++i) { -- cgit v1.2.3