wayland: Do not cancel data source on offer destruction

This is wrong for both clipboard and DnD, as the selection source
will still be able to focus another surface, and churn another
wl_offer.

We should just detach the data offer from the data source in this
case, and let the source live on. However, we should still check
that there is a source and an offer to finish DnD, do that when
handling the drop operation instead.

https://gitlab.gnome.org/GNOME/mutter/issues/591

(cherry picked from commit 48639ac5da)
This commit is contained in:
Carlos Garnacho 2019-11-20 00:30:23 +01:00
parent e2d6b33b61
commit edb618b2a4

View File

@ -571,12 +571,7 @@ destroy_data_offer (struct wl_resource *resource)
WL_DATA_OFFER_ACTION_SINCE_VERSION)
meta_wayland_data_source_notify_finish (offer->source);
else
{
if (seat->data_device.dnd_data_source == offer->source)
unset_selection_source (&seat->data_device, META_SELECTION_DND);
meta_wayland_data_source_cancel (offer->source);
meta_wayland_data_source_set_current_offer (offer->source, NULL);
}
meta_wayland_data_source_set_current_offer (offer->source, NULL);
}
g_object_remove_weak_pointer (G_OBJECT (offer->source),
@ -1036,6 +1031,7 @@ drag_grab_button (MetaWaylandPointerGrab *grab,
gboolean success;
if (drag_grab->drag_focus && source &&
meta_wayland_data_source_get_current_offer (source) &&
meta_wayland_data_source_has_target (source) &&
meta_wayland_data_source_get_current_action (source))
{