From e93adbee074a2527e83851a1690440ce53aa021b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 30 Jun 2023 09:19:18 +0100 Subject: [PATCH] xwayland: Guard against xwyayland connection closing in input spy The event spy is removed when xwayland closed, but it's based on the process not the wayland socket, so it can be temporarily out of sync. There were no guards for the connection being null. BUG: 471789 --- src/xwayland/xwayland.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index d7951c5f5e..47dc83d0c8 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -157,8 +157,9 @@ public: return; } - auto client = surface->client(); - if (waylandServer()->xWaylandConnection() != client) { + KWaylandServer::ClientConnection *client = surface->client(); + KWaylandServer::ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection(); + if (xwaylandClient && xwaylandClient != client) { KWaylandServer::KeyboardKeyState state{event->type() == QEvent::KeyPress}; if (!updateKey(event->nativeScanCode(), state)) { return; @@ -170,7 +171,7 @@ public: xkb->modifierState().locked, xkb->currentLayout()); - waylandServer()->seat()->keyboard()->sendKey(event->nativeScanCode(), state, waylandServer()->xWaylandConnection()); + waylandServer()->seat()->keyboard()->sendKey(event->nativeScanCode(), state, xwaylandClient); } }