[PATCH] Add a missing NULL check for device->grab.

Tiago Vignatti tiago.vignatti at nokia.com
Tue Jan 11 06:22:46 PST 2011


Hi Dima; comments below.

On Sat, Jan 08, 2011 at 04:48:09PM -0800, ext Dima Ryazanov wrote:
> 
> This is my first attempt at fixing a Wayland bug, as well as my first time
> using Git. Hopefully, I'm doing it right :)

I don't know how you generated the patch but it didn't apply okay for me. I
guess due the following line wrap that happened for some reason (your email
client?):

    > +               device->grab->interface->button(device->grab, time, button,
    > state);

Have you used git format-patch for it?

 
> Wayland compositor sometimes crashes if you start a client, move the
> client's window, then right-click and drag the empty space.
> Not sure if that's the correct solution, but it fixes the crash.
> 
> Signed-off-by: Dima Ryazanov <dima at gmail.com>
> ---
>  compositor/compositor.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/compositor/compositor.c b/compositor/compositor.c
> index 1e6f2ef..87ea03c 100644
> --- a/compositor/compositor.c
> +++ b/compositor/compositor.c
> @@ -925,10 +925,12 @@ notify_button(struct wl_input_device *device,
>                              &surface->surface, device, time,
>                              WL_GRAB_RESIZE_BOTTOM_RIGHT);
> 
> -       device->grab->interface->button(device->grab, time, button, state);
> +       if (device->grab) {
> +               device->grab->interface->button(device->grab, time, button,
> state);
> 
> -       if (!state && device->grab && device->grab_button == button)
> -               wl_input_device_end_grab(device, time);
> +               if (!state && device->grab_button == button)
> +                       wl_input_device_end_grab(device, time);
> +       }
>  }

I can confirm your patch fix this issue indeed:
Tested-by: Tiago Vignatti <tiago.vignatti at nokia.com>

OTOH, I'm not sure if this is the right approach for fixing this bug on the
composite manager. I'm failing to see any code that implements the grabbing of
objects among clients; or a drag happening between a non-surface and a
surface, which is your issue. If that's the case, then your fix seems okay.

Kristian may give a clear answer though. Thanks!

             Tiago


More information about the wayland-devel mailing list