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

Jonas Ã…dahl jadahl at gmail.com
Thu May 14 00:43:43 PDT 2015


On Thu, Jan 22, 2015 at 05:40:29PM +0200, Giulio Camuffo wrote:
> 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.

Found this patch in patchwork. Something for the release maybe?

> ---
>  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);
> +	}

Do we care about sending wl_surface_leave for all the surfaces that
entered it before it being removed? I suppose the global being removed
implies that though, so maybe that is a bit unnecessary.

Anyway, I think this needs a minor modification before merging: we need
to update the output mask of all the views and their corresponding
surfaces in order to not potentially fail to send future
wl_surface.enter where a new wl_output happens to get the same ID as the
one being destroyed here.


Jonas

>  }
>  
>  static void
> -- 
> 2.2.2
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list