[PATCH weston 3/4] data-device: fix crash on systems with no pointer device
Stanislav Vorobiov
s.vorobiov at samsung.com
Tue May 6 02:52:20 PDT 2014
---
src/data-device.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/data-device.c b/src/data-device.c
index 6a81bc8..a80f271 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -650,11 +650,13 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
struct weston_surface *icon = NULL;
int32_t ret = 0;
- if ((seat->pointer->button_count == 0 ||
+ if ((!seat->pointer ||
+ seat->pointer->button_count == 0 ||
seat->pointer->grab_serial != serial ||
!seat->pointer->focus ||
seat->pointer->focus->surface != wl_resource_get_user_data(origin_resource)) &&
- (seat->touch->grab_serial != serial ||
+ (!seat->touch ||
+ seat->touch->grab_serial != serial ||
!seat->touch->focus ||
seat->touch->focus->surface != wl_resource_get_user_data(origin_resource)))
return;
@@ -672,14 +674,16 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
return;
}
- if (seat->pointer->button_count == 1 &&
+ if (seat->pointer &&
+ seat->pointer->button_count == 1 &&
seat->pointer->grab_serial == serial &&
seat->pointer->focus &&
seat->pointer->focus->surface == wl_resource_get_user_data(origin_resource))
ret = weston_pointer_start_drag(seat->pointer, source, icon, client);
- else if (seat->touch->grab_serial != serial ||
- seat->touch->focus ||
- seat->touch->focus->surface != wl_resource_get_user_data(origin_resource))
+ else if (seat->touch &&
+ (seat->touch->grab_serial != serial ||
+ seat->touch->focus ||
+ seat->touch->focus->surface != wl_resource_get_user_data(origin_resource)))
ret = weston_touch_start_drag(seat->touch, source, icon, client);
if (ret < 0)
--
1.7.9.5
More information about the wayland-devel
mailing list