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

Dima Ryazanov dima at gmail.com
Sat Jan 8 16:48:09 PST 2011


Hi everyone,

This is my first attempt at fixing a Wayland bug, as well as my first time
using Git. Hopefully, I'm doing it right :)

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

 void
-- 
1.7.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20110108/50ccbc73/attachment.html>


More information about the wayland-devel mailing list