From 1e16ab2567bd9b0d20b12a7bc3af9126f9b03a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 1 Jun 2015 16:51:27 +0200 Subject: [PATCH] Set Toplevel::m_surface to nullptr if SurfaceInterface gets destroyed When minimizing an Xwayland client the Xwayland server destroys the Surface causing our next access to the Surface to crash KWin. So for safety we connect to the destroyed signal and reset the pointer. The disadvantage is that a minimized Xwayland window doesn't have a preview any more. --- toplevel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toplevel.cpp b/toplevel.cpp index 8f80323e82..4d86b09f5a 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -458,6 +458,11 @@ void Toplevel::setSurface(KWayland::Server::SurfaceInterface *surface) } m_surface = surface; connect(m_surface, &SurfaceInterface::damaged, this, &Toplevel::addDamage); + connect(m_surface, &SurfaceInterface::destroyed, this, + [this] { + m_surface = nullptr; + } + ); } #endif