diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-08-21 11:48:04 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-08-21 15:51:26 +0000 |
commit | ce615a44c06ed10ab51b9c5a630acb43ef014efb (patch) | |
tree | ad31fe3fcba3f36efad671503c385582ec2ae650 | |
parent | 91a1797a96400febb384aaa7feb1a8369ee5b571 (diff) |
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.
-rw-r--r-- | render/egl.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/render/egl.c b/render/egl.c index 8986117d..ea743e9a 100644 --- a/render/egl.c +++ b/render/egl.c @@ -388,7 +388,9 @@ static bool egl_init(struct wlr_egl *egl, EGLenum platform, } if (!egl_init_display(egl, display)) { - eglTerminate(display); + if (egl->exts.KHR_display_reference) { + eglTerminate(display); + } return false; } @@ -613,9 +615,12 @@ void wlr_egl_destroy(struct wlr_egl *egl) { wlr_drm_format_set_finish(&egl->dmabuf_texture_formats); eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(egl->display, egl->context); - eglTerminate(egl->display); + + if (egl->exts.KHR_display_reference) { + eglTerminate(egl->display); + } + eglReleaseThread(); if (egl->gbm_device) { |