[Cogl] [PATCH 1/6] wayland: Disconnect the display when the renderer disconnects

Neil Roberts neil at linux.intel.com
Fri Jun 28 10:03:06 PDT 2013


If we don't do this then it might leak connections to the display if
multiple different renderers are tried.
---
 cogl/winsys/cogl-winsys-egl-wayland.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
index 0df5639..c4c11b5 100644
--- a/cogl/winsys/cogl-winsys-egl-wayland.c
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
@@ -100,8 +100,18 @@ static void
 _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 {
   CoglRendererEGL *egl_renderer = renderer->winsys;
+  CoglRendererWayland *wayland_renderer = egl_renderer->platform;
+
+  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);
+    }
 
-  eglTerminate (egl_renderer->edpy);
+  if (egl_renderer->edpy)
+    eglTerminate (egl_renderer->edpy);
 
   g_slice_free (CoglRendererWayland, egl_renderer->platform);
   g_slice_free (CoglRendererEGL, egl_renderer);
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list