[PATCH weston v2] compositor: make sure to reset views' pointers to destroyed output

Giulio Camuffo giuliocamuffo at gmail.com
Thu Jan 22 07:40:29 PST 2015


When an output is destroyed reassign the output of the views that
were in it, to be sure not to keep a dangling pointer which could
be used later on by calling weston_surface_assign_output() on the
view's surface.
---
 src/compositor.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 821970a..2c02ca5 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3247,6 +3247,7 @@ WL_EXPORT void
 weston_output_destroy(struct weston_output *output)
 {
 	struct wl_resource *resource;
+	struct weston_view *view;
 
 	output->destroying = 1;
 
@@ -3268,6 +3269,11 @@ weston_output_destroy(struct weston_output *output)
 	}
 
 	wl_global_destroy(output->global);
+
+	wl_list_for_each(view, &output->compositor->view_list, link) {
+		if (view->output == output)
+			weston_view_assign_output(view);
+	}
 }
 
 static void
-- 
2.2.2



More information about the wayland-devel mailing list