compositor-wayland: Destroy cursor images earlier
authorDaniel Stone <daniels@collabora.com>
Thu, 24 Nov 2016 15:31:33 +0000 (15:31 +0000)
committerDaniel Stone <daniels@collabora.com>
Tue, 29 Nov 2016 09:49:29 +0000 (09:49 +0000)
Destroying a wl_cursor will attempt to access the wl_display, which
we have just freed. Avoid a segfault by destroying the cursor images
before we destroy the display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
libweston/compositor-wayland.c

index 60cd18493e9e18fe8a52181acfbe351d091c9ab1..d1e387df67500c8cac817fefab66def4b74f8a28 100644 (file)
@@ -2372,10 +2372,6 @@ wayland_destroy(struct weston_compositor *ec)
        if (b->parent.compositor)
                wl_compositor_destroy(b->parent.compositor);
 
-       wl_registry_destroy(b->parent.registry);
-       wl_display_flush(b->parent.wl_display);
-       wl_display_disconnect(b->parent.wl_display);
-
        if (b->theme)
                theme_destroy(b->theme);
 
@@ -2384,6 +2380,10 @@ wayland_destroy(struct weston_compositor *ec)
 
        wl_cursor_theme_destroy(b->cursor_theme);
 
+       wl_registry_destroy(b->parent.registry);
+       wl_display_flush(b->parent.wl_display);
+       wl_display_disconnect(b->parent.wl_display);
+
        free(b);
 }