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.
icc-effect-5.14.5
Martin Gräßlin 2015-06-01 16:51:27 +02:00
parent 5a98d8bbbd
commit 1e16ab2567
1 changed files with 5 additions and 0 deletions

View File

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