mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	subsurface: handle NULL parent in get_root_surface
This commit is contained in:
		
							parent
							
								
									ad4dae0844
								
							
						
					
					
						commit
						f6fc4c2883
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -220,7 +220,8 @@ struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface,
 | 
				
			||||||
		struct wl_list *resource_list);
 | 
							struct wl_list *resource_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Get the root of the subsurface tree for this surface.
 | 
					 * Get the root of the subsurface tree for this surface. Can return NULL if
 | 
				
			||||||
 | 
					 * a surface in the tree has been destroyed.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface);
 | 
					struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1061,6 +1061,9 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface) {
 | 
				
			||||||
		if (subsurface == NULL) {
 | 
							if (subsurface == NULL) {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (subsurface->parent == NULL) {
 | 
				
			||||||
 | 
								return NULL;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		surface = subsurface->parent;
 | 
							surface = subsurface->parent;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return surface;
 | 
						return surface;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue