From 79ef1be57bc4710973e7f90754a72391b258f2c2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 3 Jun 2024 10:23:57 +0000 Subject: [PATCH] xwayland: Avoid crash if processing keys after xwayland is disconnected Whilst the XWayland input filter only runs whilst XWayland is running there is hypothetical window between the wayland connection to xwayland being disconnected and handleXwaylandFinished, the process exiting. This should be guarded correctly. BUG: 480925 --- src/xwayland/xwayland.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index a2e8dcc53c..6df28fa369 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -382,9 +382,13 @@ public: auto surface = keyboard->focusedSurface(); ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection(); + if (!xwaylandClient) { + return; + } + if (surface) { ClientConnection *client = surface->client(); - if (xwaylandClient && xwaylandClient == client) { + if (xwaylandClient == client) { return; } }