[PATCH weston] libweston-desktop/xwayland: Do not over-destroy the view

Giulio Camuffo giuliocamuffo at gmail.com
Tue Sep 6 08:07:03 UTC 2016


2016-09-01 2:27 GMT+03:00 Quentin Glidic <sardemff7+wayland at sardemff7.net>:
> On 30/08/2016 02:26, Bryce Harrington wrote:
>>
>> On Thu, Aug 18, 2016 at 04:45:30PM +0200, Quentin Glidic wrote:
>>>
>>> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>>>
>>> With this weston_view_destroy() call, Xwayland popups make Weston freeze
>>> in a busy-loop (probably corrupted wl_list).
>>
>>
>> Looks like weston_desktop_surface_unlink_view() calls
>> weston_desktop_view_destroy() for the specified surface->view, and that
>> in turn will call weston_view_destroy() on the view (if it is
>> parentless), and then frees it.
>>
>> So, you're right, the view is definitely going gone once
>> weston_desktop_surface_unlink_view() is done, and can't be used by any
>> subsequent calls.

Actually weston_desktop_surface_unlink_view() does not destroy the
view, but it is destroyed later, after the pointer's listener on the
resource destruction is fired, and that fixes the infinite loop. So
yeah, this is a bit magic i'd say.

>>
>> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
>>
>> This fix is okayed to land for the release, and can be landed either
>> pre- or post- beta.
>
>
> Still not sure this fix is not pure magic, but anyway.
> Thanks, pushed:
> 5c611d9..1714f01  master -> master
>
> Cheers,
>
>
>
>>> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
>>> ---
>>>  libweston-desktop/xwayland.c | 6 ++----
>>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
>>> index cb08323..bd68bc6 100644
>>> --- a/libweston-desktop/xwayland.c
>>> +++ b/libweston-desktop/xwayland.c
>>> @@ -152,13 +152,11 @@ weston_desktop_xwayland_surface_destroy(struct
>>> weston_desktop_surface *dsurface,
>>>         wl_list_remove(&surface->resource_destroy_listener.link);
>>>
>>>         weston_desktop_surface_unset_relative_to(surface->surface);
>>> -       if (surface->added) {
>>> +       if (surface->added)
>>>                 weston_desktop_api_surface_removed(surface->desktop,
>>>                                                    surface->surface);
>>> -       } else if (surface->state == XWAYLAND) {
>>> +       else if (surface->state == XWAYLAND)
>>>                 weston_desktop_surface_unlink_view(surface->view);
>>> -               weston_view_destroy(surface->view);
>>> -       }
>>>
>>>         free(surface);
>>>  }
>>> --
>>> 2.9.2
>>>
>>> _______________________________________________
>>> wayland-devel mailing list
>>> wayland-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
>
> --
>
> Quentin “Sardem FF7” Glidic
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list