mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	layer-shell: handle serial wrapping overflow
This commit is contained in:
		
							parent
							
								
									4a4da256dd
								
							
						
					
					
						commit
						b937c7b05e
					
				
					 1 changed files with 13 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -58,20 +58,17 @@ static void layer_surface_handle_ack_configure(struct wl_client *client,
 | 
			
		|||
		struct wl_resource *resource, uint32_t serial) {
 | 
			
		||||
	struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource);
 | 
			
		||||
 | 
			
		||||
	bool found = false;
 | 
			
		||||
	struct wlr_layer_surface_v1_configure *configure, *tmp;
 | 
			
		||||
 | 
			
		||||
	if (!surface || surface->closed) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
 | 
			
		||||
		if (configure->serial < serial) {
 | 
			
		||||
			layer_surface_configure_destroy(configure);
 | 
			
		||||
		} else if (configure->serial == serial) {
 | 
			
		||||
 | 
			
		||||
	// First find the ack'ed configure
 | 
			
		||||
	bool found = false;
 | 
			
		||||
	struct wlr_layer_surface_v1_configure *configure, *tmp;
 | 
			
		||||
	wl_list_for_each(configure, &surface->configure_list, link) {
 | 
			
		||||
		if (configure->serial == serial) {
 | 
			
		||||
			found = true;
 | 
			
		||||
			break;
 | 
			
		||||
		} else {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (!found) {
 | 
			
		||||
| 
						 | 
				
			
			@ -80,6 +77,13 @@ static void layer_surface_handle_ack_configure(struct wl_client *client,
 | 
			
		|||
			"wrong configure serial: %u", serial);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	// Then remove old configures from the list
 | 
			
		||||
	wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) {
 | 
			
		||||
		if (configure->serial == serial) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		layer_surface_configure_destroy(configure);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (surface->acked_configure) {
 | 
			
		||||
		layer_surface_configure_destroy(surface->acked_configure);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue