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
This commit is contained in:
parent
ba4e42d139
commit
96ce7bd2ad
1 changed files with 3 additions and 1 deletions
|
@ -1525,7 +1525,9 @@ void Toplevel::clientMessageEvent(xcb_client_message_event_t *e)
|
|||
if (e->type == atoms->wl_surface_id) {
|
||||
m_surfaceId = e->data.data32[0];
|
||||
if (auto w = waylandServer()) {
|
||||
m_surface = KWayland::Server::SurfaceInterface::get(m_surfaceId, w->xWaylandConnection());
|
||||
if (auto s = KWayland::Server::SurfaceInterface::get(m_surfaceId, w->xWaylandConnection())) {
|
||||
setSurface(s);
|
||||
}
|
||||
}
|
||||
emit surfaceIdChanged(m_surfaceId);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue