wayland/subsurface: Check for circular relationships
If a subsurface is equal to or an ancestor of the parent surface we currently crash. Check for that case and terminate the client.
Closes #1521 (closed)
For the record: I tested against the following crash reproducers:
wl_subcompositor_get_subsurface(subcompositor, subsurface1, subsurface2);
wl_subcompositor_get_subsurface(subcompositor, subsurface2, subsurface1);
and
wl_subcompositor_get_subsurface(subcompositor, subsurface1, subsurface2);
wl_subcompositor_get_subsurface(subcompositor, subsurface2, subsurface3);
wl_subcompositor_get_subsurface(subcompositor, subsurface3, subsurface1);
See also https://bugzilla.mozilla.org/show_bug.cgi?id=1675402
Edited by Robert Mader