mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
render/gles2: fix EGL use-after-free
The wlr_egl was cleaned up too early.
While at it, also fix a memory leak.
Fixes: b899a412e3
("backend: remove wlr_egl from all backends")
This commit is contained in:
parent
248b8e647a
commit
2585f322cb
1 changed files with 3 additions and 1 deletions
|
@ -674,7 +674,6 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
|
||||||
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
||||||
|
|
||||||
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
||||||
wlr_egl_finish(renderer->egl);
|
|
||||||
|
|
||||||
struct wlr_gles2_buffer *buffer, *buffer_tmp;
|
struct wlr_gles2_buffer *buffer, *buffer_tmp;
|
||||||
wl_list_for_each_safe(buffer, buffer_tmp, &renderer->buffers, link) {
|
wl_list_for_each_safe(buffer, buffer_tmp, &renderer->buffers, link) {
|
||||||
|
@ -696,6 +695,9 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
|
||||||
|
|
||||||
wlr_egl_unset_current(renderer->egl);
|
wlr_egl_unset_current(renderer->egl);
|
||||||
|
|
||||||
|
wlr_egl_finish(renderer->egl);
|
||||||
|
free(renderer->egl);
|
||||||
|
|
||||||
if (renderer->drm_fd >= 0) {
|
if (renderer->drm_fd >= 0) {
|
||||||
close(renderer->drm_fd);
|
close(renderer->drm_fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue