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

Dima Ryazanov dima at gmail.com
Tue Jan 11 12:40:38 PST 2011


[second attempt]

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



More information about the wayland-devel mailing list