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
master
Simon Ser 1 year ago
parent c4d4409deb
commit 1e68e1f661

@ -473,11 +473,6 @@ void seat_client_create_inert_keyboard(struct wl_client *client,
} }
void seat_client_destroy_keyboard(struct wl_resource *resource) { 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_remove(wl_resource_get_link(resource));
wl_list_init(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource));
wl_resource_set_user_data(resource, NULL); wl_resource_set_user_data(resource, NULL);

@ -553,11 +553,6 @@ void seat_client_create_inert_pointer(struct wl_client *client,
} }
void seat_client_destroy_pointer(struct wl_resource *resource) { 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_remove(wl_resource_get_link(resource));
wl_list_init(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource));
wl_resource_set_user_data(resource, NULL); wl_resource_set_user_data(resource, NULL);

@ -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) { 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_remove(wl_resource_get_link(resource));
wl_list_init(wl_resource_get_link(resource)); wl_list_init(wl_resource_get_link(resource));
wl_resource_set_user_data(resource, NULL); wl_resource_set_user_data(resource, NULL);

Loading…
Cancel
Save