[cogl] wayland: Disconnect the display when the renderer disconnects



commit 8e5b4d40a4d960d0d20927d30ee68a37387fe776
Author: Neil Roberts <neil linux intel com>
Date:   Fri Jun 28 12:09:35 2013 +0100

    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>

 cogl/winsys/cogl-winsys-egl-wayland.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]