mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	egl: Don't assume display is owned when KHR_display_reference is unsupported
We could potentially leak a display here, but not really because the display acts as a singleton that will be returned next time a renderer of the same device is created.
This commit is contained in:
		
							parent
							
								
									91a1797a96
								
							
						
					
					
						commit
						ce615a44c0
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								render/egl.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								render/egl.c
									
										
									
									
									
								
							| 
						 | 
					@ -388,7 +388,9 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!egl_init_display(egl, display)) {
 | 
						if (!egl_init_display(egl, display)) {
 | 
				
			||||||
		eglTerminate(display);
 | 
							if (egl->exts.KHR_display_reference) {
 | 
				
			||||||
 | 
								eglTerminate(display);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -613,9 +615,12 @@ void wlr_egl_destroy(struct wlr_egl *egl) {
 | 
				
			||||||
	wlr_drm_format_set_finish(&egl->dmabuf_texture_formats);
 | 
						wlr_drm_format_set_finish(&egl->dmabuf_texture_formats);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 | 
						eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	eglDestroyContext(egl->display, egl->context);
 | 
						eglDestroyContext(egl->display, egl->context);
 | 
				
			||||||
	eglTerminate(egl->display);
 | 
					
 | 
				
			||||||
 | 
						if (egl->exts.KHR_display_reference) {
 | 
				
			||||||
 | 
							eglTerminate(egl->display);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eglReleaseThread();
 | 
						eglReleaseThread();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (egl->gbm_device) {
 | 
						if (egl->gbm_device) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue