[PATCH weston] xwm: reset the surface and shsurf field on surface destruction

Giulio Camuffo giuliocamuffo at gmail.com
Wed Sep 11 09:06:40 PDT 2013


we may still get events from x, so  by setting those fields to NULL
we make sure we don't try to use destroyed objects.
---
 src/xwayland/window-manager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index e1f26f6..912553e 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -1878,6 +1878,9 @@ surface_destroy(struct wl_listener *listener, void *data)
 		container_of(listener,
 			     struct weston_wm_window, surface_destroy_listener);
 
+	window->surface = NULL;
+	/* This should have been freed by the shell */
+	window->shsurf = NULL;
 	wm_log("surface for xid %d destroyed\n", window->id);
 
 	window->surface = NULL;
-- 
1.8.4



More information about the wayland-devel mailing list