mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	src/xdg.c: remove all listeners in handle_destroy()
This commit is contained in:
		
							parent
							
								
									22ba7f6744
								
							
						
					
					
						commit
						665b6503e1
					
				
					 1 changed files with 23 additions and 4 deletions
				
			
		
							
								
								
									
										27
									
								
								src/xdg.c
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/xdg.c
									
										
									
									
									
								
							| 
						 | 
					@ -7,6 +7,13 @@
 | 
				
			||||||
#include "view-impl-common.h"
 | 
					#include "view-impl-common.h"
 | 
				
			||||||
#include "workspaces.h"
 | 
					#include "workspaces.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct xdg_toplevel_view *
 | 
				
			||||||
 | 
					xdg_toplevel_view_from_view(struct view *view)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						assert(view->type == LAB_XDG_SHELL_VIEW);
 | 
				
			||||||
 | 
						return (struct xdg_toplevel_view *)view;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_xdg_surface *
 | 
					struct wlr_xdg_surface *
 | 
				
			||||||
xdg_surface_from_view(struct view *view)
 | 
					xdg_surface_from_view(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -114,14 +121,26 @@ handle_destroy(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct view *view = wl_container_of(listener, view, destroy);
 | 
						struct view *view = wl_container_of(listener, view, destroy);
 | 
				
			||||||
	assert(view->type == LAB_XDG_SHELL_VIEW);
 | 
						assert(view->type == LAB_XDG_SHELL_VIEW);
 | 
				
			||||||
 | 
						struct xdg_toplevel_view *xdg_toplevel_view =
 | 
				
			||||||
 | 
							xdg_toplevel_view_from_view(view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Reset XDG specific surface for good measure */
 | 
						xdg_toplevel_view->xdg_surface->data = NULL;
 | 
				
			||||||
	((struct xdg_toplevel_view *)view)->xdg_surface = NULL;
 | 
						xdg_toplevel_view->xdg_surface = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wl_list_remove(&view->map.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->unmap.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->request_move.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->request_resize.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->request_minimize.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->request_maximize.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->request_fullscreen.link);
 | 
				
			||||||
 | 
						wl_list_remove(&view->set_title.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wl_list_remove(&xdg_toplevel_view->set_app_id.link);
 | 
				
			||||||
 | 
						wl_list_remove(&xdg_toplevel_view->new_popup.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Remove XDG specific handlers */
 | 
					 | 
				
			||||||
	wl_list_remove(&view->destroy.link);
 | 
						wl_list_remove(&view->destroy.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* And finally destroy / free the view */
 | 
					 | 
				
			||||||
	view_destroy(view);
 | 
						view_destroy(view);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue