[PATCH 1/6] compositor: use wl_list_for_each_safe when destroying output

Tiago Vignatti vignatti at freedesktop.org
Mon Dec 19 02:30:23 PST 2011


From: Tiago Vignatti <tiago.vignatti at intel.com>

Was causing an invalid read when the output is in fact destroyed. That's only
visible (segfault on my machine) on drm compositor because it's the only
backend trying to finish correct the compositor.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 compositor/compositor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compositor/compositor.c b/compositor/compositor.c
index cb9b41f..fc75689 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -1932,10 +1932,10 @@ wlsc_compositor_init(struct wlsc_compositor *ec, struct wl_display *display)
 WL_EXPORT void
 wlsc_compositor_shutdown(struct wlsc_compositor *ec)
 {
-	struct wlsc_output *output;
+	struct wlsc_output *output, *next;
 
 	/* Destroy all outputs associated with this compositor */
-	wl_list_for_each(output, &ec->output_list, link)
+	wl_list_for_each_safe(output, next, &ec->output_list, link)
 		output->destroy(output);
 }
 
-- 
1.7.5.4



More information about the wayland-devel mailing list