[gtk+] wayland: Fix thinko in wl_data_source.cancelled handler



commit dcfa55ac7e119f8ae8e5670291fdd20968fc5a58
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Mar 17 17:59:15 2015 +0100

    wayland: Fix thinko in wl_data_source.cancelled handler
    
    The wl_data_source may be the clipboard's. Looking up the drag context in
    order to get the display isn't going to fare well there. So, just use the
    default display, and only look up the drag context when we know we need it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746386

 gdk/wayland/gdkselection-wayland.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index 39a5f22..651785a 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -668,16 +668,19 @@ data_source_cancelled (void                  *data,
   g_debug (G_STRLOC ": %s source = %p",
            G_STRFUNC, source);
 
-  context = gdk_wayland_drag_context_lookup_by_data_source (source);
-  display = gdk_window_get_display (context->source_window);
+  display = gdk_display_get_default ();
 
   if (source == wayland_selection->dnd_source)
-    gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]);
+    {
+      gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]);
+
+      context = gdk_wayland_drag_context_lookup_by_data_source (source);
+
+      if (context)
+        gdk_wayland_drag_context_undo_grab (context);
+    }
   else if (source == wayland_selection->clipboard_source)
     gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]);
-
-  if (context)
-    gdk_wayland_drag_context_undo_grab (context);
 }
 
 static const struct wl_data_source_listener data_source_listener = {


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