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 <robert@linux.intel.com>

(cherry picked from commit 358d85f35d0fe36698b758163729c4551fe5fd25)
This commit is contained in:
Neil Roberts 2013-08-19 15:08:37 +01:00
parent 07930069d3
commit 45550cd343

View File

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