When a weston seat or input object is destroyed, any associated client
resources should become inert and put in a state in which they can
safely handle client requests. Currently, client requests to such
resources may lead to crashes and/or memory errors in the server.
This patchset aims to fix (or at least greatly improve) the situation.
Patches (1) to (3) ensure that when the various input objects are
destroyed, any associated resources are made inert and can safely handle
Patches (4) to (6) update the test infrastructure to properly support
requests to dynamically add and remove the test seat.
Patch (7) introduces a test for removing and re-adding the test seat.
This test indirectly checks some of the input code fixes made in patches
(1) to (3). Even without some of the fixes, the test may seem to pass.
However, running with a memory debugger reveals a different story, since
without the fixes we encounter various memory errors.
Since the v1 proposal, I have been able to investigate the issues
triggered by the new test. The conclusion is that the problem was caused
by the desktop shell due to an inherent race in the way wayland deals
with removal of globals. In particular, if a global is removed while a
client has in-flight requests for it, the server will reply with a
protocol error and kill the client. To work around this, v2 changes the
devices tests to use the test desktop shell which doesn't deal with
wl_seat globals and is thus not affected by this race.
More detailed changes introduced in v2 are provided in each patch.
Alexandros Frantzis (7):
libweston: Support NULL weston_pointer in init_pointer_constraint
libweston: Make weston_pointer destruction safe
libweston: Make weston_seat release safe
tests: Handle removal of seat global in test clients
tests: Support setting the test client input dynamically
tests: Run devices tests using the test desktop shell
tests: Add test for seat destruction and creation
compositor/text-backend.c | 8 ++-
libweston-desktop/wl-shell.c | 12 +++-
libweston-desktop/xdg-shell-v5.c | 16 +++++-
libweston-desktop/xdg-shell-v6.c | 18 +++++-
libweston/data-device.c | 15 +++--
libweston/input.c | 117 ++++++++++++++++++++++++++++----------
libweston/zoom.c | 5 +-
tests/devices-test.c | 34 +++++++++++
tests/weston-test-client-helper.c | 116 ++++++++++++++++++++++++++-----------
tests/weston-test-client-helper.h | 2 +
10 files changed, 269 insertions(+), 74 deletions(-)
wayland-devel mailing list