wayland: Disconnect the display when the renderer disconnects

If we don't do this then it might leak connections to the display if
multiple different renderers are tried.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8e5b4d40a4d960d0d20927d30ee68a37387fe776)
This commit is contained in:
Neil Roberts 2013-06-28 12:09:35 +01:00
parent 2f4d66f950
commit 813e8f3a98

View File

@ -100,8 +100,18 @@ static void
_cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
{
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererWayland *wayland_renderer = egl_renderer->platform;
eglTerminate (egl_renderer->edpy);
if (wayland_renderer->wayland_display)
{
_cogl_poll_renderer_remove_fd (renderer, wayland_renderer->fd);
if (renderer->foreign_wayland_display == NULL)
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);