[PATCH weston 2/2] compositor-wayland: Destroy cursor images earlier

Daniel Stone daniels at collabora.com
Thu Nov 24 15:32:41 UTC 2016


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 at collabora.com>
---
 libweston/compositor-wayland.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index d9cbde5..aa69c68 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -2368,10 +2368,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);
 
@@ -2380,6 +2376,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);
 }
 
-- 
2.9.3



More information about the wayland-devel mailing list