mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	input/input-manager: remove event listeners on fini
This fixes a crash in wlroots listener checks. See #8509.
This commit is contained in:
		
							parent
							
								
									0a9b0b83eb
								
							
						
					
					
						commit
						e51ecf71aa
					
				
					 3 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -39,6 +39,8 @@ struct sway_input_manager {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct sway_input_manager *input_manager_create(struct sway_server *server);
 | 
					struct sway_input_manager *input_manager_create(struct sway_server *server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void input_manager_finish(struct sway_input_manager *input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool input_manager_has_focus(struct sway_node *node);
 | 
					bool input_manager_has_focus(struct sway_node *node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void input_manager_set_focus(struct sway_node *node);
 | 
					void input_manager_set_focus(struct sway_node *node);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -493,6 +493,14 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) {
 | 
				
			||||||
	return input;
 | 
						return input;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void input_manager_finish(struct sway_input_manager *input) {
 | 
				
			||||||
 | 
						wl_list_remove(&input->new_input.link);
 | 
				
			||||||
 | 
						wl_list_remove(&input->virtual_keyboard_new.link);
 | 
				
			||||||
 | 
						wl_list_remove(&input->virtual_pointer_new.link);
 | 
				
			||||||
 | 
						wl_list_remove(&input->keyboard_shortcuts_inhibit_new_inhibitor.link);
 | 
				
			||||||
 | 
						wl_list_remove(&input->transient_seat_create.link);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool input_manager_has_focus(struct sway_node *node) {
 | 
					bool input_manager_has_focus(struct sway_node *node) {
 | 
				
			||||||
	struct sway_seat *seat = NULL;
 | 
						struct sway_seat *seat = NULL;
 | 
				
			||||||
	wl_list_for_each(seat, &server.input->seats, link) {
 | 
						wl_list_for_each(seat, &server.input->seats, link) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -478,6 +478,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_request_activate.link);
 | 
				
			||||||
	wl_list_remove(&server->xdg_activation_v1_new_token.link);
 | 
						wl_list_remove(&server->xdg_activation_v1_new_token.link);
 | 
				
			||||||
	wl_list_remove(&server->request_set_cursor_shape.link);
 | 
						wl_list_remove(&server->request_set_cursor_shape.link);
 | 
				
			||||||
 | 
						input_manager_finish(server->input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: free sway-specific resources
 | 
						// TODO: free sway-specific resources
 | 
				
			||||||
#if WLR_HAS_XWAYLAND
 | 
					#if WLR_HAS_XWAYLAND
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue