wayland-drm: close fd after the display is uninitialized
authorPhilipp Brüschweiler <blei42@gmail.com>
Wed, 15 Aug 2012 16:14:44 +0000 (18:14 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 16 Aug 2012 17:17:06 +0000 (13:17 -0400)
This fixes a "kernel rejected pushbuf: Bad file descriptor" error on
wl_drm display destruction.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/gallium/state_trackers/egl/wayland/native_drm.c

index 006b3d507afb510a051800d9885cca550edf3536..c6f61978ab07fb8015f3fdff1823e1831c4bf4c7 100644 (file)
@@ -71,8 +71,6 @@ wayland_drm_display_destroy(struct native_display *ndpy)
 {
    struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
 
-   if (drmdpy->fd)
-      close(drmdpy->fd);
    if (drmdpy->wl_drm)
       wl_drm_destroy(drmdpy->wl_drm);
    if (drmdpy->device_name)
@@ -84,6 +82,9 @@ wayland_drm_display_destroy(struct native_display *ndpy)
 
    ndpy_uninit(ndpy);
 
+   if (drmdpy->fd)
+      close(drmdpy->fd);
+
    FREE(drmdpy);
 }