[mutter/wip/carlosg/fix-dnd-crash: 3/4] wayland: Do not cancel data source on offer destruction



commit cbee5802804dc4b2f54776b6e1c904316064424b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Nov 20 00:30:23 2019 +0100

    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

 src/wayland/meta-wayland-data-device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 5a669b5f5..c83667b16 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -582,12 +582,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),
@@ -1045,6 +1040,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))
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]