[plasma/plasma-keyboard] src: fix: don't be a zombie if the connection to the compositor is lost
Kristen McWilliam <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit fc5aabab255b7e2359fa421ec5d1633eb9f97d5a by Kristen McWilliam.
Committed on 04/08/2026 at 18:56.
Pushed by merritt into branch 'master'.
fix: don't be a zombie if the connection to the compositor is lost
Previously if the connection to the compositor was lost, we would just
continue running while being unable to do any input method work.
This was problematic for the flatpak installation of plasma-keyboard,
which could even accumulate multiple running instances if toggled on/off
in the KCM repeatedly.
Resolves https://invent.kde.org/plasma/plasma-keyboard/-/work_items/85
M +13 -0 src/inputmethod.cpp
https://invent.kde.org/plasma/plasma-keyboard/-/commit/fc5aabab255b7e2359fa421ec5d1633eb9f97d5a
diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp
index 44b9aad..c632b5f 100644
--- a/src/inputmethod.cpp
+++ b/src/inputmethod.cpp
@@ -5,6 +5,8 @@
*/
#include "inputmethod_p.h"
+#include "logging.h"
+
#include <QDateTime>
#include <QDebug>
#include <QGuiApplication>
@@ -19,6 +21,17 @@
InputMethod::InputMethod()
: QWaylandClientExtensionTemplate<InputMethod>(1)
{
+ connect(
+ this,
+ &InputMethod::activeChanged,
+ this,
+ [this]() {
+ if (!isActive()) {
+ qCDebug(PlasmaKeyboard) << "Connection to the Wayland compositor has been lost; exiting plasma-keyboard.";
+ QCoreApplication::quit();
+ }
+ },
+ Qt::QueuedConnection);
}
InputMethod::~InputMethod() = default;