From 1e68e1f661e3e9a03ce306ed1e03976942444e96 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 15 Jun 2023 15:14:35 +0200 Subject: [PATCH] seat: fix keyboard/pointer/touch resource destroy We need to always unlink the resource, even if it's already inert. seat_client_destroy_*() may be called multiple times on the same resource. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3638 --- types/seat/wlr_seat_keyboard.c | 5 ----- types/seat/wlr_seat_pointer.c | 5 ----- types/seat/wlr_seat_touch.c | 5 ----- 3 files changed, 15 deletions(-) diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c index 1dab1b32..0193d58d 100644 --- a/types/seat/wlr_seat_keyboard.c +++ b/types/seat/wlr_seat_keyboard.c @@ -473,11 +473,6 @@ void seat_client_create_inert_keyboard(struct wl_client *client, } void seat_client_destroy_keyboard(struct wl_resource *resource) { - struct wlr_seat_client *seat_client = - seat_client_from_keyboard_resource(resource); - if (seat_client == NULL) { - return; - } wl_list_remove(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource)); wl_resource_set_user_data(resource, NULL); diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 5d623dbc..830a885e 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -553,11 +553,6 @@ void seat_client_create_inert_pointer(struct wl_client *client, } void seat_client_destroy_pointer(struct wl_resource *resource) { - struct wlr_seat_client *seat_client = - wlr_seat_client_from_pointer_resource(resource); - if (seat_client == NULL) { - return; - } wl_list_remove(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource)); wl_resource_set_user_data(resource, NULL); diff --git a/types/seat/wlr_seat_touch.c b/types/seat/wlr_seat_touch.c index 764b58e5..4eb52ed6 100644 --- a/types/seat/wlr_seat_touch.c +++ b/types/seat/wlr_seat_touch.c @@ -454,11 +454,6 @@ void seat_client_create_inert_touch(struct wl_client *client, uint32_t version, } void seat_client_destroy_touch(struct wl_resource *resource) { - struct wlr_seat_client *seat_client = - seat_client_from_touch_resource(resource); - if (seat_client == NULL) { - return; - } wl_list_remove(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource)); wl_resource_set_user_data(resource, NULL);