diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-08-22 10:17:12 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-25 12:00:28 +0000 |
commit | fd785c3899d21dd05fd013336bbc63ce818dc2a6 (patch) | |
tree | 553dd288e83b5f984f04c2c8609ffb8b8eace2b4 /src/corelib/text | |
parent | 0d336ab3132c85781fc62b9d92dce690b8ff9d59 (diff) |
QtCore: port all QMutexLocker users to qt_{scoped,unique}_lock
... 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 <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qregexp.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp index d81826b47b..41f3508ff8 100644 --- a/src/corelib/text/qregexp.cpp +++ b/src/corelib/text/qregexp.cpp @@ -52,6 +52,7 @@ #include "qstringlist.h" #include "qstringmatcher.h" #include "qvector.h" +#include "private/qlocking_p.h" #include <limits.h> #include <algorithm> @@ -3825,7 +3826,7 @@ static QBasicMutex engineCacheMutex; static void derefEngine(QRegExpEngine *eng, const QRegExpEngineKey &key) { #if !defined(QT_NO_REGEXP_OPTIM) - QMutexLocker locker(&engineCacheMutex); + const auto locker = qt_scoped_lock(engineCacheMutex); if (!eng->ref.deref()) { if (QRECache *c = engineCache()) { c->unusedEngines.insert(key, eng, 4 + key.pattern.length() / 4); @@ -3846,7 +3847,7 @@ static void prepareEngine_helper(QRegExpPrivate *priv) Q_ASSERT(!priv->eng); #if !defined(QT_NO_REGEXP_OPTIM) - QMutexLocker locker(&engineCacheMutex); + const auto locker = qt_scoped_lock(engineCacheMutex); if (QRECache *c = engineCache()) { priv->eng = c->unusedEngines.take(priv->engineKey); if (!priv->eng) |