Skip to content

wayland: Handle xdg_wm_base being destroyed before surface role

Vlad Zahorodnii requested to merge work/cherry-pick-16a07d5d into Plasma/5.27

If a client owns several windows (for example it can be the case with plasmashell) and it crashes, it's possible to encounter the following case:

  • xdg_wm_base resources are destroyed
  • xdg_toplevel is destroyed
  • another xdg_toplevel is destroyed

When kwin processes the destruction of the first xdg_toplevel, it may ping the second xdg_toplevel. But the xdg_wm_base is already free()d by that time, so kwin can access already released memory.

In order to prevent that, make the associated XdgSurfaceInterface objects inert. Since XdgToplevelInterface and XdgPopupInterface will become useless after destroying XdgSurfaceInterface, make them inert too.

As the spec states, it's illegal to destroy a bound xdg_wm_base object while there are still alive xdg surfaces created by it so destroying the surface role objects should be fine.

(cherry picked from commit 16a07d5d)

Merge request reports

Loading