[PATCH weston] compositor: when unmapping a surface remove it from the compositor's list

Giulio Camuffo giuliocamuffo at gmail.com
Sat Sep 21 09:08:28 PDT 2013


compositor.surface_list is recreated every redraw with the mapped
surfaces, but if a surface gets unmapped and then in the same frame
weston_compositor_pick_surface() is called we must make sure it
does not pick the unmapped surface, since it traverses the
surface_list to find one.
If after the unmap the surface gets also deleted it's even more
important, as it must not pick a destroyed surface.
---
 src/compositor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index a1c01fb..fefa001 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -994,6 +994,8 @@ weston_surface_unmap(struct weston_surface *surface)
 	surface->mapped = 0;
 	surface->output = NULL;
 	wl_list_remove(&surface->layer_link);
+	wl_list_remove(&surface->link);
+	wl_list_init(&surface->link);
 
 	wl_list_for_each(seat, &surface->compositor->seat_list, link) {
 		if (seat->keyboard && seat->keyboard->focus == surface)
-- 
1.8.4



More information about the wayland-devel mailing list