mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #1067 from emersion/fix-surface-double-release
surface: fix double wl_buffer.release events
This commit is contained in:
		
						commit
						cc89906ddf
					
				
					 1 changed files with 4 additions and 9 deletions
				
			
		| 
						 | 
					@ -325,8 +325,7 @@ static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void surface_apply_damage(struct wlr_surface *surface,
 | 
					static void surface_apply_damage(struct wlr_surface *surface) {
 | 
				
			||||||
		bool invalid_buffer) {
 | 
					 | 
				
			||||||
	struct wl_resource *resource = surface->current->buffer;
 | 
						struct wl_resource *resource = surface->current->buffer;
 | 
				
			||||||
	if (resource == NULL) {
 | 
						if (resource == NULL) {
 | 
				
			||||||
		// NULL commit
 | 
							// NULL commit
 | 
				
			||||||
| 
						 | 
					@ -335,12 +334,6 @@ static void surface_apply_damage(struct wlr_surface *surface,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (surface->buffer != NULL && !surface->buffer->released &&
 | 
					 | 
				
			||||||
			!invalid_buffer) {
 | 
					 | 
				
			||||||
		// The buffer is still the same, no need to re-upload
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (surface->buffer != NULL && surface->buffer->released) {
 | 
						if (surface->buffer != NULL && surface->buffer->released) {
 | 
				
			||||||
		pixman_region32_t damage;
 | 
							pixman_region32_t damage;
 | 
				
			||||||
		pixman_region32_init(&damage);
 | 
							pixman_region32_init(&damage);
 | 
				
			||||||
| 
						 | 
					@ -376,7 +369,9 @@ static void surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface_move_state(surface, surface->pending, surface->current);
 | 
						surface_move_state(surface, surface->pending, surface->current);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface_apply_damage(surface, invalid_buffer);
 | 
						if (invalid_buffer) {
 | 
				
			||||||
 | 
							surface_apply_damage(surface);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// commit subsurface order
 | 
						// commit subsurface order
 | 
				
			||||||
	struct wlr_subsurface *subsurface;
 | 
						struct wlr_subsurface *subsurface;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue