mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xwayland/selection: don't leak Wayland fd if ConvertSelection fails
If our ConvertSelection failed, we would previously leak the pending Wayland client fd. Refs swaywm/sway#5946.
This commit is contained in:
		
							parent
							
								
									e0dfc14983
								
							
						
					
					
						commit
						3417fc0cca
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -397,11 +397,14 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
 | 
			
		|||
 | 
			
		||||
	if (event->property == XCB_ATOM_NONE) {
 | 
			
		||||
		wlr_log(WLR_ERROR, "convert selection failed");
 | 
			
		||||
		xwm_selection_transfer_finish(&selection->incoming);
 | 
			
		||||
	} else if (event->target == xwm->atoms[TARGETS]) {
 | 
			
		||||
		// No xwayland surface focused, deny access to clipboard
 | 
			
		||||
		if (xwm->focus_surface == NULL) {
 | 
			
		||||
			wlr_log(WLR_DEBUG, "denying write access to clipboard: "
 | 
			
		||||
				"no xwayland surface focused");
 | 
			
		||||
			// Would leak this transfer otherwise. Should never happen.
 | 
			
		||||
			assert(selection->incoming.wl_client_fd <= 0);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue