egl/wayland: properly destroy wayland objects
authorAxel Davy <axel.davy@ens.fr>
Thu, 30 Apr 2015 22:03:32 +0000 (00:03 +0200)
committerAxel Davy <axel.davy@ens.fr>
Mon, 11 May 2015 17:31:43 +0000 (19:31 +0200)
the wl_registry and the wl_queue allocated weren't destroyed.

CC: 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_wayland.c

index f4c29da61cfb1a98564d9efdee4bd6287a499cda..169abcc4c63d9dd0edb7db2fd9457139a2a4cb28 100644 (file)
@@ -730,6 +730,8 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
 #ifdef HAVE_WAYLAND_PLATFORM
    case _EGL_PLATFORM_WAYLAND:
       wl_drm_destroy(dri2_dpy->wl_drm);
+      wl_registry_destroy(dri2_dpy->wl_registry);
+      wl_event_queue_destroy(dri2_dpy->wl_queue);
       if (dri2_dpy->own_device) {
          wl_display_disconnect(dri2_dpy->wl_dpy);
       }
index e2260053917e152b5ead81ff738a885796d4367c..a5bcf25af4133db3d0bda64b60ca10fc0af2b4f1 100644 (file)
@@ -1029,7 +1029,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
    wl_registry_add_listener(dri2_dpy->wl_registry,
                             &registry_listener, dri2_dpy);
    if (roundtrip(dri2_dpy) < 0 || dri2_dpy->wl_drm == NULL)
-      goto cleanup_dpy;
+      goto cleanup_registry;
 
    if (roundtrip(dri2_dpy) < 0 || dri2_dpy->fd == -1)
       goto cleanup_drm;
@@ -1112,6 +1112,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
  cleanup_drm:
    free(dri2_dpy->device_name);
    wl_drm_destroy(dri2_dpy->wl_drm);
+ cleanup_registry:
+   wl_registry_destroy(dri2_dpy->wl_registry);
+   wl_event_queue_destroy(dri2_dpy->wl_queue);
  cleanup_dpy:
    free(dri2_dpy);