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