mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	wayland-server: Don't close display fd in fatal error handler
We can't do that there, we have to make sure it stays a valid fd until the application calls wl_display_disconnect(). Otherwise the application may end up poll()ing on a stale or wrong fd in case another part of the application (or another thread) triggered a fatal error.
This commit is contained in:
		
							parent
							
								
									becca5fcf7
								
							
						
					
					
						commit
						93d888aec6
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		| 
						 | 
					@ -107,8 +107,6 @@ display_fatal_error(struct wl_display *display, int error)
 | 
				
			||||||
		error = 1;
 | 
							error = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display->last_error = error;
 | 
						display->last_error = error;
 | 
				
			||||||
	close(display->fd);
 | 
					 | 
				
			||||||
	display->fd = -1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_for_each(iter, &display->event_queue_list, link)
 | 
						wl_list_for_each(iter, &display->event_queue_list, link)
 | 
				
			||||||
		pthread_cond_broadcast(&iter->cond);
 | 
							pthread_cond_broadcast(&iter->cond);
 | 
				
			||||||
| 
						 | 
					@ -612,7 +610,6 @@ wl_display_disconnect(struct wl_display *display)
 | 
				
			||||||
	wl_event_queue_release(&display->queue);
 | 
						wl_event_queue_release(&display->queue);
 | 
				
			||||||
	pthread_mutex_destroy(&display->mutex);
 | 
						pthread_mutex_destroy(&display->mutex);
 | 
				
			||||||
	pthread_cond_destroy(&display->reader_cond);
 | 
						pthread_cond_destroy(&display->reader_cond);
 | 
				
			||||||
	if (display->fd > 0)
 | 
					 | 
				
			||||||
	close(display->fd);
 | 
						close(display->fd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(display);
 | 
						free(display);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue