From fe56f36dd0e54a5facee8fd296f574e226e75961 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 9 Mar 2022 17:42:42 +0100 Subject: [PATCH] Port to QRecursiveMutex Recursive and non-recursive mutexes are distinct types in Qt6. --- src/backends/libinput/connection.cpp | 1 - src/backends/libinput/connection.h | 4 ++-- src/scripting/scripting.cpp | 2 +- src/scripting/scripting.h | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index 2ecc100131..e3c9cbd719 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -126,7 +126,6 @@ Connection::Connection(Context *input, QObject *parent) : QObject(parent) , m_input(input) , m_notifier(nullptr) - , m_mutex(QMutex::Recursive) { Q_ASSERT(m_input); // need to connect to KGlobalSettings as the mouse KCM does not emit a dedicated signal diff --git a/src/backends/libinput/connection.h b/src/backends/libinput/connection.h index c5178cf4e1..ea700762bd 100644 --- a/src/backends/libinput/connection.h +++ b/src/backends/libinput/connection.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -67,7 +67,7 @@ private: void applyScreenToDevice(Device *device); Context *m_input; QSocketNotifier *m_notifier; - QMutex m_mutex; + QRecursiveMutex m_mutex; QVector m_eventQueue; QVector m_devices; KSharedConfigPtr m_config; diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index aa51eb7c6d..0713cfaa76 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -626,7 +626,7 @@ KWin::Scripting *KWin::Scripting::create(QObject *parent) KWin::Scripting::Scripting(QObject *parent) : QObject(parent) - , m_scriptsLock(new QMutex(QMutex::Recursive)) + , m_scriptsLock(new QRecursiveMutex) , m_qmlEngine(new QQmlEngine(this)) , m_declarativeScriptSharedContext(new QQmlContext(m_qmlEngine, this)) , m_workspaceWrapper(new QtScriptWorkspaceWrapper(this)) diff --git a/src/scripting/scripting.h b/src/scripting/scripting.h index 8814dec94c..644475d4cf 100644 --- a/src/scripting/scripting.h +++ b/src/scripting/scripting.h @@ -28,7 +28,7 @@ class QQmlContext; class QQmlEngine; class QAction; class QMenu; -class QMutex; +class QRecursiveMutex; class QQuickWindow; class KConfigGroup; @@ -315,7 +315,7 @@ private: /** * Lock to protect the scripts member variable. */ - QScopedPointer m_scriptsLock; + QScopedPointer m_scriptsLock; // Preferably call ONLY at load time void runScripts();