From 5bef385ffc636cd89e7b535dc173b6df096a64b6 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 14 Mar 2024 13:21:57 +0100 Subject: [PATCH] tablet_v2: destroy tablet seats on manager destroy This fixes an invalid write in tablet_seat_destroy if the tablet manager is destroyed before the wlr_seat. --- types/tablet_v2/wlr_tablet_v2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/tablet_v2/wlr_tablet_v2.c b/types/tablet_v2/wlr_tablet_v2.c index 3182effe..b0f35dff 100644 --- a/types/tablet_v2/wlr_tablet_v2.c +++ b/types/tablet_v2/wlr_tablet_v2.c @@ -271,6 +271,12 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { wl_container_of(listener, manager, display_destroy); wl_signal_emit_mutable(&manager->events.destroy, manager); wl_list_remove(&manager->display_destroy.link); + + struct wlr_tablet_seat_v2 *seat, *tmp; + wl_list_for_each_safe(seat, tmp, &manager->seats, link) { + tablet_seat_destroy(seat); + } + wl_global_destroy(manager->wl_global); free(manager); }