mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Fix wlr_wl/xdg_shell_destroy segfault
- Implement xdg_shell_destroy and use it at the right place (impl->destroy is never called) - Remove wl_global_destroy for now, something is missing with the display/registry_resource_list
This commit is contained in:
		
							parent
							
								
									f9b55dfa95
								
							
						
					
					
						commit
						dca3f630dd
					
				
					 2 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -145,6 +145,7 @@ void wlr_wl_shell_destroy(struct wlr_wl_shell *wlr_wl_shell) {
 | 
			
		|||
		wl_list_remove(link);
 | 
			
		||||
	}
 | 
			
		||||
	// TODO: destroy surfaces
 | 
			
		||||
	wl_global_destroy(wlr_wl_shell->wl_global);
 | 
			
		||||
	// TODO: this segfault (wl_display->registry_resource_list is not init)
 | 
			
		||||
	// wl_global_destroy(wlr_wl_shell->wl_global);
 | 
			
		||||
	free(wlr_wl_shell);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,12 +158,15 @@ static void xdg_shell_pong(struct wl_client *client,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static struct zxdg_shell_v6_interface xdg_shell_impl = {
 | 
			
		||||
	.destroy = resource_destroy,
 | 
			
		||||
	.create_positioner = xdg_shell_create_positioner,
 | 
			
		||||
	.get_xdg_surface = xdg_shell_get_xdg_surface,
 | 
			
		||||
	.pong = xdg_shell_pong,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void xdg_shell_destroy(struct wl_resource *resource) {
 | 
			
		||||
	wl_list_remove(wl_resource_get_link(resource));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void xdg_shell_bind(struct wl_client *wl_client, void *_xdg_shell,
 | 
			
		||||
		uint32_t version, uint32_t id) {
 | 
			
		||||
	struct wlr_xdg_shell_v6 *xdg_shell = _xdg_shell;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +178,7 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *_xdg_shell,
 | 
			
		|||
	}
 | 
			
		||||
	struct wl_resource *wl_resource = wl_resource_create(
 | 
			
		||||
		wl_client, &zxdg_shell_v6_interface, version, id);
 | 
			
		||||
	wl_resource_set_implementation(wl_resource, &xdg_shell_impl, xdg_shell, NULL);
 | 
			
		||||
	wl_resource_set_implementation(wl_resource, &xdg_shell_impl, xdg_shell, xdg_shell_destroy);
 | 
			
		||||
	wl_list_insert(&xdg_shell->wl_resources, wl_resource_get_link(wl_resource));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -207,6 +210,7 @@ void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell) {
 | 
			
		|||
		wl_list_remove(link);
 | 
			
		||||
	}
 | 
			
		||||
	// TODO: destroy surfaces
 | 
			
		||||
	wl_global_destroy(xdg_shell->wl_global);
 | 
			
		||||
	// TODO: this segfault (wl_display->registry_resource_list is not init)
 | 
			
		||||
	// wl_global_destroy(xdg_shell->wl_global);
 | 
			
		||||
	free(xdg_shell);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue