diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-06-28 16:32:37 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-31 15:36:47 +0200 |
commit | 8af01ac984908ba58e682263187b2ceb5faf2f8f (patch) | |
tree | 74401a54176d9407471c8fc9bee9824a2ab93f58 | |
parent | 68375389bf09427103ab3ff2b7fb1517e9b55615 (diff) |
Port from QMutex::Recursive to QRecursiveMutex
Also port from QMutexLocker to std::lock_guard, as the former will not
support QRecursiveMutex going forward.
Change-Id: I38a2711c64ae149001e780cc57fc95657c33d6d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/plugins/t9write/plugin/t9writeinputmethod.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/plugins/t9write/plugin/t9writeinputmethod.cpp b/src/plugins/t9write/plugin/t9writeinputmethod.cpp index 1626a199..53b20c6e 100644 --- a/src/plugins/t9write/plugin/t9writeinputmethod.cpp +++ b/src/plugins/t9write/plugin/t9writeinputmethod.cpp @@ -115,7 +115,6 @@ public: defaultHwrDbPath(QLatin1String(":/QtQuick/VirtualKeyboard/T9Write/data/")), defaultDictionaryDbPath(defaultHwrDbPath), traceListHardLimit(32), - dictionaryLock(QMutex::Recursive), attachedDictionary(nullptr), resultId(0), lastResultId(0), @@ -401,7 +400,7 @@ public: bool attachDictionary(const QSharedPointer<T9WriteDictionary> &dictionary) { - QMutexLocker dictionaryGuard(&dictionaryLock); + const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock); Q_ASSERT(decumaSession != nullptr); Q_ASSERT(dictionary != nullptr); qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::attachDictionary():" << dictionary->fileName(); @@ -415,7 +414,7 @@ public: void detachDictionary(const QSharedPointer<T9WriteDictionary> &dictionary) { - QMutexLocker dictionaryGuard(&dictionaryLock); + const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock); if (!dictionary) return; @@ -945,7 +944,7 @@ public: The loading operation is blocking for the main thread only if the user starts handwriting input before the operation is complete. */ - QMutexLocker dictionaryGuard(&dictionaryLock); + const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock); // Detach previous dictionary if the language is being changed // or the recognizer mode is single-character mode @@ -1664,7 +1663,7 @@ public: QScopedPointer<T9WriteWorker> worker; QList<QVirtualKeyboardTrace *> traceList; int traceListHardLimit; - QMutex dictionaryLock; + QRecursiveMutex dictionaryLock; QString dictionaryFileName; QSharedPointer<T9WriteDictionary> loadedDictionary; QSharedPointer<T9WriteDictionary> attachedDictionary; @@ -2083,7 +2082,7 @@ void T9WriteInputMethod::timerEvent(QTimerEvent *timerEvent) // In UCR mode the whole purpose is to write the word with // one or few strokes. if (d->sessionSettings.recognitionMode == ucrMode) { - QMutexLocker dictionaryGuard(&d->dictionaryLock); + const std::lock_guard<QRecursiveMutex> dictionaryGuard(d->dictionaryLock); if (d->attachedDictionary) return; } @@ -2105,7 +2104,7 @@ void T9WriteInputMethod::dictionaryLoadCompleted(QSharedPointer<T9WriteDictionar { Q_D(T9WriteInputMethod); // Note: This method is called in worker thread context - QMutexLocker dictionaryGuard(&d->dictionaryLock); + const std::lock_guard<QRecursiveMutex> dictionaryGuard(d->dictionaryLock); if (!dictionary) return; |