From 3bedb704549c23e7c564a8e67a867f8b505b5299 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 7 Apr 2022 20:04:25 +0300 Subject: [PATCH] touch-calibration: Clean-up if touch calibrator has been enabled Seems that we're still missing layer clean-ups, with the touch calibrator being one of them. Call the appropriate function when shutting down the compositor instance. Fixes: #603 Signed-off-by: Marius Vlad --- libweston/compositor.c | 3 +++ libweston/libweston-internal.h | 2 ++ libweston/touch-calibration.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/libweston/compositor.c b/libweston/compositor.c index 34631716..cabd0d45 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -7852,6 +7852,9 @@ weston_compositor_shutdown(struct weston_compositor *ec) wl_event_source_remove(ec->idle_source); wl_event_source_remove(ec->repaint_timer); + if (ec->touch_calibration) + weston_compositor_destroy_touch_calibrator(ec); + /* Destroy all outputs associated with this compositor */ wl_list_for_each_safe(output, next, &ec->output_list, link) output->destroy(output); diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h index 7c30706f..02c4ad3b 100644 --- a/libweston/libweston-internal.h +++ b/libweston/libweston-internal.h @@ -389,6 +389,8 @@ const uint64_t * weston_drm_format_get_modifiers(const struct weston_drm_format *format, unsigned int *count_out); +void +weston_compositor_destroy_touch_calibrator(struct weston_compositor *compositor); /** * paint node * diff --git a/libweston/touch-calibration.c b/libweston/touch-calibration.c index 9dd99bba..11e59386 100644 --- a/libweston/touch-calibration.c +++ b/libweston/touch-calibration.c @@ -674,6 +674,16 @@ bind_touch_calibration(struct wl_client *client, } } +void +weston_compositor_destroy_touch_calibrator(struct weston_compositor *ec) +{ + /* TODO: handle weston_compositor::touch_calibrator destruction + * see + * https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/819#note_1345191 + */ + weston_layer_fini(&ec->calibrator_layer); +} + /** Advertise touch_calibration support * * \param compositor The compositor to init for.