From 03d0a226fb616409fb9fc4a42f91fe059062edb3 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 5 Oct 2023 21:30:24 +0200 Subject: [PATCH] waylandserver: fix race condition When the xwayland connection gets destroyed, it doesn't get deleted immediately. If the xwayland scale changes in between WaylandServer::destroyXWaylandConnection and the actual destruction of the connection, KWin would crash --- src/wayland_server.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index fffae9a093..6100b660f6 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -693,7 +693,9 @@ int WaylandServer::createXWaylandConnection() m_xwaylandConnection->setScaleOverride(kwinApp()->xwaylandScale()); connect(kwinApp(), &Application::xwaylandScaleChanged, m_xwaylandConnection, [this]() { - m_xwaylandConnection->setScaleOverride(kwinApp()->xwaylandScale()); + if (m_xwaylandConnection) { + m_xwaylandConnection->setScaleOverride(kwinApp()->xwaylandScale()); + } }); return socket.fd;