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
This commit is contained in:
Carlos Garnacho 2015-03-17 17:59:15 +01:00
parent 28063ee2e4
commit dcfa55ac7e

View File

@ -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 = {