data-device.c: Handle failure to allocate offer in weston_drag_set_focus

If we fail to allocate and send the offer, don't send the drag enter and
don't set the drag focus so we don't send motion events or leave.
This commit is contained in:
Kristian Høgsberg 2013-08-06 10:31:12 -07:00
parent 3c30f0f950
commit b10b44b58c

View File

@ -238,6 +238,8 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
if (drag->data_source) if (drag->data_source)
offer = weston_data_source_send_offer(drag->data_source, offer = weston_data_source_send_offer(drag->data_source,
resource); resource);
if (offer == NULL)
return;
wl_data_device_send_enter(resource, serial, surface->resource, wl_data_device_send_enter(resource, serial, surface->resource,
sx, sy, offer); sx, sy, offer);