[PATCH weston v2] compositor: make sure to reset views' pointers to destroyed output
Jonas Ådahl
jadahl at gmail.com
Mon Jul 13 00:44:51 PDT 2015
On Sun, Jul 12, 2015 at 10:52:32AM +0300, Giulio Camuffo wrote:
> When an output is being 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.
> Also make sure we send wl_surface.leave events to the surfaces that
> were in that output.
Reviewed-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>
> I had forgotten about this one...
> changes since v1:
> - reassign the output for all relevant views
> - send wl_surface.leave
>
> src/compositor.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/compositor.c b/src/compositor.c
> index 150d1fb..2a117d8 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -1079,6 +1079,9 @@ weston_view_assign_output(struct weston_view *ev)
> mask = 0;
> pixman_region32_init(®ion);
> wl_list_for_each(output, &ec->output_list, link) {
> + if (output->destroying)
> + continue;
> +
> pixman_region32_intersect(®ion, &ev->transform.boundingbox,
> &output->region);
>
> @@ -3888,9 +3891,15 @@ WL_EXPORT void
> weston_output_destroy(struct weston_output *output)
> {
> struct wl_resource *resource;
> + struct weston_view *view;
>
> output->destroying = 1;
>
> + wl_list_for_each(view, &output->compositor->view_list, link) {
> + if (view->output_mask & (1 << output->id))
> + weston_view_assign_output(view);
> + }
> +
> wl_event_source_remove(output->repaint_timer);
>
> weston_presentation_feedback_discard_list(&output->feedback_list);
> --
> 2.4.5
>
> _______________________________________________
> 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