diff --git a/0001-wayland-Destroy-InputRedirection-explicitly.patch b/0001-wayland-Destroy-InputRedirection-explicitly.patch deleted file mode 100644 index 8c4b43a..0000000 --- a/0001-wayland-Destroy-InputRedirection-explicitly.patch +++ /dev/null @@ -1,58 +0,0 @@ -From a24350624ecc2460fa917adf8890af92f309ffdd Mon Sep 17 00:00:00 2001 -From: Vlad Zahorodnii -Date: Mon, 27 Sep 2021 13:02:24 +0300 -Subject: [PATCH 1/4] wayland: Destroy InputRedirection explicitly - -CCBUG: 442104 - - -(cherry picked from commit 7900068cab6e34e0517439c17438ad544ceb602f) ---- - src/main.cpp | 5 +++++ - src/main.h | 1 + - src/main_wayland.cpp | 1 + - 3 files changed, 7 insertions(+) - -diff --git a/src/main.cpp b/src/main.cpp -index c5870356a..93e327b89 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -330,6 +330,11 @@ void Application::removeNativeX11EventFilter() - removeNativeEventFilter(m_eventFilter.data()); - } - -+void Application::destroyInput() -+{ -+ delete InputRedirection::self(); -+} -+ - void Application::destroyWorkspace() - { - delete Workspace::self(); -diff --git a/src/main.h b/src/main.h -index 606b0669f..30469e3bf 100644 ---- a/src/main.h -+++ b/src/main.h -@@ -233,6 +233,7 @@ protected: - void createColorManager(); - void installNativeX11EventFilter(); - void removeNativeX11EventFilter(); -+ void destroyInput(); - void destroyWorkspace(); - void destroyCompositor(); - void destroyPlugins(); -diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp -index cb3fc2ac3..a11d75dff 100644 ---- a/src/main_wayland.cpp -+++ b/src/main_wayland.cpp -@@ -137,6 +137,7 @@ ApplicationWayland::~ApplicationWayland() - } - waylandServer()->terminateClientConnections(); - destroyCompositor(); -+ destroyInput(); - } - - void ApplicationWayland::performStartup() --- -2.32.0 - diff --git a/0002-wayland-Move-ownership-of-the-libinput-thread-to-Inp.patch b/0002-wayland-Move-ownership-of-the-libinput-thread-to-Inp.patch deleted file mode 100644 index d92a868..0000000 --- a/0002-wayland-Move-ownership-of-the-libinput-thread-to-Inp.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 6c60391ad32445e31938fab2fc65af5a5821a6fb Mon Sep 17 00:00:00 2001 -From: Vlad Zahorodnii -Date: Mon, 27 Sep 2021 13:10:37 +0300 -Subject: [PATCH 2/4] wayland: Move ownership of the libinput thread to - InputRedirection - -When libinput tears down, it may access the Session object. This change -re-jitters the shut down logic so the Session object is guaranteed to be -valid when libinput stuff gets destroyed. - -BUG: 442104 - -(cherry picked from commit d7d1c6600ab9c95fb852a66d2a8fb745caa5d716) ---- - src/input.cpp | 16 ++++++++++++++++ - src/input.h | 1 + - src/libinput/connection.cpp | 19 +------------------ - src/libinput/connection.h | 3 --- - 4 files changed, 18 insertions(+), 21 deletions(-) - -diff --git a/src/input.cpp b/src/input.cpp -index 7ebad3052..29648b375 100644 ---- a/src/input.cpp -+++ b/src/input.cpp -@@ -53,6 +53,7 @@ - #include - // Qt - #include -+#include - - #include - -@@ -2082,6 +2083,14 @@ InputRedirection::InputRedirection(QObject *parent) - - InputRedirection::~InputRedirection() - { -+ if (m_libInput) { -+ m_libInput->deleteLater(); -+ -+ m_libInputThread->quit(); -+ m_libInputThread->wait(); -+ delete m_libInputThread; -+ } -+ - s_self = nullptr; - qDeleteAll(m_filters); - qDeleteAll(m_spies); -@@ -2319,8 +2328,15 @@ void InputRedirection::setupLibInput() - if (m_libInput) { - return; - } -+ -+ m_libInputThread = new QThread(); -+ m_libInputThread->setObjectName(QStringLiteral("libinput-connection")); -+ m_libInputThread->start(); -+ - LibInput::Connection *conn = LibInput::Connection::create(this); - m_libInput = conn; -+ m_libInput->moveToThread(m_libInputThread); -+ - if (conn) { - - if (waylandServer()) { -diff --git a/src/input.h b/src/input.h -index 8d9d40ce4..8b69dee5a 100644 ---- a/src/input.h -+++ b/src/input.h -@@ -325,6 +325,7 @@ private: - GlobalShortcutsManager *m_shortcuts; - - LibInput::Connection *m_libInput = nullptr; -+ QThread *m_libInputThread = nullptr; - - WindowSelectorFilter *m_windowSelector = nullptr; - -diff --git a/src/libinput/connection.cpp b/src/libinput/connection.cpp -index 9cca61a3b..104f2ea94 100644 ---- a/src/libinput/connection.cpp -+++ b/src/libinput/connection.cpp -@@ -31,7 +31,6 @@ - #include - #include - #include --#include - - #include - #include -@@ -81,7 +80,6 @@ Q_SIGNALS: - }; - - Connection *Connection::s_self = nullptr; --QPointer Connection::s_thread; - - static ConnectionAdaptor *s_adaptor = nullptr; - static Context *s_context = nullptr; -@@ -107,16 +105,6 @@ Connection::Connection(QObject *parent) - // only here to fix build, using will crash, BUG 343529 - } - --void Connection::createThread() --{ -- if (s_thread) { -- return; -- } -- s_thread = new QThread(); -- s_thread->setObjectName(QStringLiteral("libinput-connection")); -- s_thread->start(); --} -- - Connection *Connection::create(QObject *parent) - { - Q_ASSERT(!s_self); -@@ -141,12 +129,7 @@ Connection *Connection::create(QObject *parent) - return nullptr; - } - } -- Connection::createThread(); - s_self = new Connection(s_context); -- s_self->moveToThread(s_thread); -- QObject::connect(s_thread, &QThread::finished, s_self, &QObject::deleteLater); -- QObject::connect(s_thread, &QThread::finished, s_thread, &QObject::deleteLater); -- QObject::connect(parent, &QObject::destroyed, s_thread, &QThread::quit); - if (!s_adaptor) { - s_adaptor = new ConnectionAdaptor(s_self); - } -@@ -335,7 +318,7 @@ void Connection::processEvents() - switch (event->type()) { - case LIBINPUT_EVENT_DEVICE_ADDED: { - auto device = new Device(event->nativeDevice()); -- device->moveToThread(s_thread); -+ device->moveToThread(thread()); - m_devices << device; - if (device->isKeyboard()) { - m_keyboard++; -diff --git a/src/libinput/connection.h b/src/libinput/connection.h -index 61dbd2488..f4f1d523c 100644 ---- a/src/libinput/connection.h -+++ b/src/libinput/connection.h -@@ -87,8 +87,6 @@ public: - - void updateLEDs(KWin::Xkb::LEDs leds); - -- static void createThread(); -- - Q_SIGNALS: - void keyChanged(quint32 key, KWin::InputRedirection::KeyboardKeyState, quint32 time, KWin::LibInput::Device *device); - void pointerButtonChanged(quint32 button, KWin::InputRedirection::PointerButtonState state, quint32 time, KWin::LibInput::Device *device); -@@ -163,7 +161,6 @@ private: - Xkb::LEDs m_leds; - - KWIN_SINGLETON(Connection) -- static QPointer s_thread; - }; - - } --- -2.32.0 - diff --git a/0003-wayland-Move-ConnectionAdaptor-to-the-same-thread-as.patch b/0003-wayland-Move-ConnectionAdaptor-to-the-same-thread-as.patch deleted file mode 100644 index 1e6313c..0000000 --- a/0003-wayland-Move-ConnectionAdaptor-to-the-same-thread-as.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 112b1127178034a214e4585cef1e3516c6fa476c Mon Sep 17 00:00:00 2001 -From: Vlad Zahorodnii -Date: Tue, 28 Sep 2021 18:24:12 +0300 -Subject: [PATCH 3/4] wayland: Move ConnectionAdaptor to the same thread as - Connection - -Connection deletes the ConnectionAdaptor, but they are in different -threads, which is weird. - -CCBUG: 442104 - - -(cherry picked from commit 6513c66ca6edb7d7bffcaec173eb1c12d2242aac) ---- - src/libinput/connection.cpp | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/src/libinput/connection.cpp b/src/libinput/connection.cpp -index 104f2ea94..a7b068dda 100644 ---- a/src/libinput/connection.cpp -+++ b/src/libinput/connection.cpp -@@ -51,10 +51,11 @@ private: - - public: - ConnectionAdaptor(Connection *con) -- : m_con(con) -+ : QObject(con) -+ , m_con(con) - { -- connect(con, &Connection::deviceAddedSysName, this, &ConnectionAdaptor::deviceAdded, Qt::QueuedConnection); -- connect(con, &Connection::deviceRemovedSysName, this, &ConnectionAdaptor::deviceRemoved, Qt::QueuedConnection); -+ connect(con, &Connection::deviceAddedSysName, this, &ConnectionAdaptor::deviceAdded); -+ connect(con, &Connection::deviceRemovedSysName, this, &ConnectionAdaptor::deviceRemoved); - - QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/InputDevice"), - QStringLiteral("org.kde.KWin.InputDeviceManager"), -@@ -68,15 +69,12 @@ public: - } - - QStringList devicesSysNames() { -- // TODO: is this allowed? directly calling function of object in another thread!? -- // otherwise use signal-slot mechanism - return m_con->devicesSysNames(); - } - - Q_SIGNALS: - void deviceAdded(QString sysName); - void deviceRemoved(QString sysName); -- - }; - - Connection *Connection::s_self = nullptr; --- -2.32.0 - diff --git a/kwin.spec b/kwin.spec index 5324726..6f87ac7 100644 --- a/kwin.spec +++ b/kwin.spec @@ -17,7 +17,7 @@ Name: kwin Version: 5.22.5 -Release: 3%{?dist} +Release: 2%{?dist} Summary: KDE Window manager # all sources are effectively GPLv2+, except for: @@ -41,14 +41,6 @@ Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}. # https://github.com/KDE/kwin/commit/998bbf4e # https://bugzilla.redhat.com/show_bug.cgi?id=2011066 Patch0: 0001-Fix-wrong-cursor-hotspot-under-Wayland-on-VMs.patch -# Patches from Vlad Zahorodnii to fix crashes on logout with libinput -# libinput 1.18.901+, backported to 5.22 -# https://bugs.kde.org/show_bug.cgi?id=442104 -# https://bugs.kde.org/show_bug.cgi?id=443088 -# https://bugzilla.redhat.com/show_bug.cgi?id=2001135 -Patch1: 0001-wayland-Destroy-InputRedirection-explicitly.patch -Patch2: 0002-wayland-Move-ownership-of-the-libinput-thread-to-Inp.patch -Patch3: 0003-wayland-Move-ConnectionAdaptor-to-the-same-thread-as.patch ## proposed patches @@ -373,9 +365,6 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||: %changelog -* Wed Oct 06 2021 Adam Williamson - 5.22.5-3 -- Fix crash on logout with libinput 1.18.901+ (#2001135) - * Tue Oct 05 2021 Adam Williamson - 5.22.5-2 - Fix cursor offset on wayland in virtual machines (#2011066)