From ae83b96030206dd8dbdc6a0605ef4b7e850ddc93 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 23 Aug 2016 12:16:09 -0500 Subject: [PATCH] wayland_egl: Destroy gl context if engine info updated with NULL wl_surface We set the wayland surface to NULL in engine info, then destroy the wayland surface later. The GL stack tries to render to the destroyed surface and dies. If we destroy the GL surface when we set the engine info (before we destroy the wayland surface)it stops the GL stack from doing bad wayland calls. This fixes a crash on exit, or when any window closes when using mali GL drivers. Surprisingly, Mesa was tolerant of this. --- src/modules/evas/engines/wayland_egl/evas_engine.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c index 9d4260dfa1..a85c593e6f 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.c +++ b/src/modules/evas/engines/wayland_egl/evas_engine.c @@ -635,6 +635,16 @@ eng_setup(Evas *evas, void *info) { re = epd->engine.data.output; ob = eng_get_ob(re); + + if (!inf->info.surface && (ob->egl_surface[0] != EGL_NO_SURFACE)) + { + eglDestroySurface(ob->egl_disp, ob->egl_surface[0]); + eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + ob->egl_surface[0] = EGL_NO_SURFACE; + return 1; + } + if ((ob) && (_re_wincheck(ob))) { ob->info = inf;