summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-02-01 20:28:16 +0100
committerBryce Harrington <bryce@bryceharrington.org>2016-02-01 13:22:34 -0800
commit4061e2b67e62d5d2a635f0b87098f331082e8145 (patch)
treee91748bc3c26a4c9fd145021c6da26fce73d91ad
parentbeb7a9f92d00e83712c762fd8e2abd6f65773858 (diff)
downloadweston-4061e2b67e62d5d2a635f0b87098f331082e8145.tar.gz
data-device: Check harder for selection/non-wayland sources
We're not always dealing with weston_data_sources that have a wl_resource, or data_sources that belong to drag-and-drop. Check harder for these on the drag-and-drop code paths triggered from common code. Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
-rw-r--r--src/data-device.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/data-device.c b/src/data-device.c
index 2cfdcfe2..862a4e02 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -100,6 +100,9 @@ data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
static void
data_source_notify_finish(struct weston_data_source *source)
{
+ if (!source->actions_set)
+ return;
+
if (source->offer->in_ask &&
wl_resource_get_version(source->resource) >=
WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
@@ -157,7 +160,7 @@ data_offer_update_action(struct weston_data_offer *offer)
{
uint32_t action;
- if (!offer->source)
+ if (!offer->source || !offer->source->actions_set)
return;
action = data_offer_choose_action(offer);
@@ -268,7 +271,8 @@ destroy_data_offer(struct wl_resource *resource)
if (wl_resource_get_version(offer->resource) <
WL_DATA_OFFER_ACTION_SINCE_VERSION) {
data_source_notify_finish(offer->source);
- } else if (wl_resource_get_version(offer->source->resource) >=
+ } else if (offer->source->resource &&
+ wl_resource_get_version(offer->source->resource) >=
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) {
wl_data_source_send_cancelled(offer->source->resource);
}