input/input-manager: remove event listeners on fini

This fixes a crash in wlroots listener checks. See #8509.
This commit is contained in:
Ferdinand Bachmann 2025-02-18 01:52:25 +01:00
parent a815274280
commit eb043295bc
3 changed files with 11 additions and 0 deletions

View file

@ -39,6 +39,8 @@ struct sway_input_manager {
struct sway_input_manager *input_manager_create(struct sway_server *server);
void input_manager_finish(struct sway_server *server);
bool input_manager_has_focus(struct sway_node *node);
void input_manager_set_focus(struct sway_node *node);

View file

@ -493,6 +493,14 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) {
return input;
}
void input_manager_finish(struct sway_server *server) {
wl_list_remove(&server->input->new_input.link);
wl_list_remove(&server->input->virtual_keyboard_new.link);
wl_list_remove(&server->input->virtual_pointer_new.link);
wl_list_remove(&server->input->keyboard_shortcuts_inhibit_new_inhibitor.link);
wl_list_remove(&server->input->transient_seat_create.link);
}
bool input_manager_has_focus(struct sway_node *node) {
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) {

View file

@ -475,6 +475,7 @@ void server_fini(struct sway_server *server) {
wl_list_remove(&server->xdg_activation_v1_request_activate.link);
wl_list_remove(&server->xdg_activation_v1_new_token.link);
wl_list_remove(&server->request_set_cursor_shape.link);
input_manager_finish(server);
// TODO: free sway-specific resources
#if WLR_HAS_XWAYLAND