<div dir="ltr"><div>To be honest, I don't think I looked at the other backends too much when writing the wayland backend. I guess cleaning up myself seemed like a good idea at the time. I don't think it really matters; having it in shutdown just lets backends be lazy.<br>
</div>--Jason<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 23, 2014 at 2:03 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, 21 May 2014 09:20:02 -0700<br>
"U. Artie Eoff" <<a href="mailto:ullysses.a.eoff@intel.com">ullysses.a.eoff@intel.com</a>> wrote:<br>
<br>
> wl_list_for_each dereference's output to increment the<br>
> next iteration of the loop. However, output is free'd<br>
> inside the loop resulting in a dereference to free'd<br>
> memory.<br>
><br>
> Use wl_list_for_each_safe instead, which is designed to<br>
> handle this kind of pattern.<br>
><br>
> Signed-off-by: U. Artie Eoff <<a href="mailto:ullysses.a.eoff@intel.com">ullysses.a.eoff@intel.com</a>><br>
> ---<br>
> src/compositor-wayland.c | 4 ++--<br>
> 1 file changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c<br>
> index a08b71a..76e5396 100644<br>
> --- a/src/compositor-wayland.c<br>
> +++ b/src/compositor-wayland.c<br>
> @@ -1997,9 +1997,9 @@ err_free:<br>
> static void<br>
> wayland_compositor_destroy(struct wayland_compositor *c)<br>
> {<br>
> - struct weston_output *output;<br>
> + struct weston_output *output, *next;<br>
><br>
> - wl_list_for_each(output, &c->base.output_list, link)<br>
> + wl_list_for_each_safe(output, next, &c->base.output_list, link)<br>
> wayland_output_destroy(output);<br>
><br>
> c->base.renderer->destroy(&c->base);<br>
<br>
</div></div>The DRM, x11 and rpi backends do not do this at all. Instead they rely<br>
on weston_compositor_shutdown() to destroy all outputs and the renderer.<br>
<br>
Is there a reason why the wayland backend is different?<br>
<br>
<br>
Thanks,<br>
pq<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>