mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	server: Set client->error when we fail to send a closure
We we're using wl_event_loop_add_idle() here, but if we're failing because of OOM, that will typically also fail. Instead, use the existing client->error flag, which will break out of the event handling loop and shut down the client.
This commit is contained in:
		
							parent
							
								
									c0eb45286c
								
							
						
					
					
						commit
						7db9d248ce
					
				
					 1 changed files with 4 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -116,14 +116,6 @@ struct wl_resource {
 | 
			
		|||
 | 
			
		||||
static int wl_debug = 0;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
destroy_client(void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct wl_client *client = data;
 | 
			
		||||
 | 
			
		||||
	wl_client_destroy(client);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
WL_EXPORT void
 | 
			
		||||
wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -137,13 +129,12 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
 | 
			
		|||
	va_end(ap);
 | 
			
		||||
 | 
			
		||||
	if (closure == NULL) {
 | 
			
		||||
		resource->client->error = 1
 | 
			
		||||
		resource->client->error = 1;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (wl_closure_send(closure, resource->client->connection))
 | 
			
		||||
		wl_event_loop_add_idle(resource->client->display->loop,
 | 
			
		||||
				       destroy_client, resource->client);
 | 
			
		||||
		resource->client->error = 1;
 | 
			
		||||
 | 
			
		||||
	if (wl_debug)
 | 
			
		||||
		wl_closure_print(closure, object, true);
 | 
			
		||||
| 
						 | 
				
			
			@ -165,13 +156,12 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
 | 
			
		|||
	va_end(ap);
 | 
			
		||||
 | 
			
		||||
	if (closure == NULL) {
 | 
			
		||||
		resource->client->error = 1
 | 
			
		||||
		resource->client->error = 1;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (wl_closure_queue(closure, resource->client->connection))
 | 
			
		||||
		wl_event_loop_add_idle(resource->client->display->loop,
 | 
			
		||||
				       destroy_client, resource->client);
 | 
			
		||||
		resource->client->error = 1;
 | 
			
		||||
 | 
			
		||||
	if (wl_debug)
 | 
			
		||||
		wl_closure_print(closure, object, true);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue