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
This commit is contained in:
Xaver Hugl 2023-10-05 21:30:24 +02:00
parent 2eb72d0820
commit 03d0a226fb

View file

@ -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;