[cogl/cogl-1.16] wayland: Disconnect the display when the renderer disconnects



commit 813e8f3a98fb31ac0910134be1596149e74880aa
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>
    
    (cherry picked from commit 8e5b4d40a4d960d0d20927d30ee68a37387fe776)

 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 35a3cc1..f1357bb 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]