[PATCH] compositor: fix dangling pointer
Pekka Paalanen
ppaalanen at gmail.com
Tue Feb 14 23:35:40 PST 2012
On Tue, 14 Feb 2012 23:00:03 +0100
Pavel Sterin <codeatstake at googlemail.com> wrote:
> if a client crashes during drag and drop a notify_motion
> can be triggered after the surface has been destroyed, so traverse
> all the input devices and look reset the corresponding grab
> focus.
> ---
> src/compositor.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/compositor.c b/src/compositor.c
> index ab90ded..b3e61eb 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -602,6 +602,12 @@ destroy_surface(struct wl_resource *resource)
> struct weston_surface, surface.resource);
> struct weston_compositor *compositor = surface->compositor;
>
> + wl_list_for_each(device, &compositor->input_device_list, link) {
> + if (device->input_device.grab->focus == (struct wl_surface *) surface) {
> + device->input_device.grab->focus = NULL;
> + }
> + }
> +
> if (surface->output) {
> weston_surface_damage_below(surface);
> weston_surface_flush_damage(surface);
Looks ok as a stop-gap measure to me, FWIW.
Thanks,
pq
More information about the wayland-devel
mailing list