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.
This commit is contained in:
Derek Foreman 2016-08-23 12:16:09 -05:00
parent 5d527fffc8
commit ae83b96030
1 changed files with 10 additions and 0 deletions

View File

@ -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;