Diffusion KWin 96ce7bd2ad92

Properly call Toplevel::setSurface for wl_surface_id X11 client message event

Authored by graesslin on Jun 10 2016, 2:15 PM.

Description

Properly call Toplevel::setSurface for wl_surface_id X11 client message event

Summary:
For an X11 window through Xwayland KWin gets a client message with the
Surface id. KWin has two code paths for handling that:

  • Wayland Surface is created after the X11 event
  • Wayland Surface is created before the X11 event

In the first code path in WaylandServer KWin called Toplevel::setSurface,
the other code path just updated the m_surface without calling into
setSurface. This means the connects for the Surface were not set up,
resulting in the worst case in accessing deleted memory after the Surface
was destroyed.

This change now ensures that setSurface is called from both code paths.
That should fix the potential crash and could also be a fix to the
problem that sometimes X windows seem to not be damaged correctly.

Reviewers: KWin, Plasma on Wayland

Subscribers: plasma-devel, kwin

Tags: Plasma on Wayland, KWin

Differential Revision: https://phabricator.kde.org/D1820