mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xwayland/selection: explicitly bail if first write to Wayland fd fails
If `xwm_data_source_write` failed, it's failed permanently. In fact, a failing `xwm_data_source_write` sets `transfer->property_reply` to null as part of its error handling. Instead of relying on an indirect check (whether `transfer->property_reply` is still non-null), explicitly use the return value from `xwm_data_source_write`.
This commit is contained in:
		
							parent
							
								
									40b2e7669a
								
							
						
					
					
						commit
						10a2d57055
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -61,9 +61,12 @@ static void xwm_write_property(struct wlr_xwm_selection_transfer *transfer,
 | 
				
			||||||
	transfer->property_start = 0;
 | 
						transfer->property_start = 0;
 | 
				
			||||||
	transfer->property_reply = reply;
 | 
						transfer->property_reply = reply;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xwm_data_source_write(transfer->wl_client_fd, WL_EVENT_WRITABLE, transfer);
 | 
						bool wl_client_finished_consuming =
 | 
				
			||||||
 | 
							!xwm_data_source_write(transfer->wl_client_fd, WL_EVENT_WRITABLE, transfer);
 | 
				
			||||||
	if (transfer->property_reply != NULL) {
 | 
						if (!wl_client_finished_consuming) {
 | 
				
			||||||
 | 
							// Wrote out part of the property to the Wayland client, but the client was
 | 
				
			||||||
 | 
							// unable to accept all of it. Schedule an event to asynchronously complete
 | 
				
			||||||
 | 
							// the transfer.
 | 
				
			||||||
		struct wl_event_loop *loop =
 | 
							struct wl_event_loop *loop =
 | 
				
			||||||
			wl_display_get_event_loop(xwm->xwayland->wl_display);
 | 
								wl_display_get_event_loop(xwm->xwayland->wl_display);
 | 
				
			||||||
		transfer->event_source = wl_event_loop_add_fd(loop,
 | 
							transfer->event_source = wl_event_loop_add_fd(loop,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue