From 45550cd3435d246c22e21380c202db0011dc4d08 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 19 Aug 2013 15:08:37 +0100 Subject: [PATCH] wayland: Call eglTerminate before destroying wl_display, not after The eglTerminate code in Mesa will try to destroy the wl_drm object which involves using data structures in the wl_display. Cogl was disconnecting the display before calling eglTerminate which meant that this would end up accessing potentially garbage data. https://bugzilla.gnome.org/show_bug.cgi?id=705591 Reviewed-by: Robert Bragg (cherry picked from commit 358d85f35d0fe36698b758163729c4551fe5fd25) --- cogl/winsys/cogl-winsys-egl-wayland.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c index d97f9ec25..628c348d5 100644 --- a/cogl/winsys/cogl-winsys-egl-wayland.c +++ b/cogl/winsys/cogl-winsys-egl-wayland.c @@ -114,6 +114,9 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer) CoglRendererEGL *egl_renderer = renderer->winsys; CoglRendererWayland *wayland_renderer = egl_renderer->platform; + if (egl_renderer->edpy) + eglTerminate (egl_renderer->edpy); + if (wayland_renderer->wayland_display) { _cogl_poll_renderer_remove_fd (renderer, wayland_renderer->fd); @@ -122,9 +125,6 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer) wl_display_disconnect (wayland_renderer->wayland_display); } - if (egl_renderer->edpy) - eglTerminate (egl_renderer->edpy); - g_slice_free (CoglRendererWayland, egl_renderer->platform); g_slice_free (CoglRendererEGL, egl_renderer); }