summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2021-07-16 22:47:40 +0100
committerAntónio Fernandes <antoniof@gnome.org>2021-07-16 23:36:25 +0100
commit67a0c763b64a7d5c0adacfa84e875ff1060a0ed3 (patch)
tree21cda0cacd991e7f7a1e5631e245d54716d46377
parent394adf648c3ddb6ea1a2f2c9b788f5d94342ca22 (diff)
downloadnautilus-67a0c763b64a7d5c0adacfa84e875ff1060a0ed3.tar.gz
window-slot-dnd: Fix data retrieval failure path
When data retrieval fails, ::drag-data-received is emitted with a selection of negative length. We have been treating this case as invalid data, but we never actually call gdk_drag_finish() which is mandatory after a drop. Instead, reset drag_info->have_data to FALSE in this case, and let slot_proxy_handle_drop() handle the rest.
-rw-r--r--src/nautilus-window-slot-dnd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index 9509d2c97..ec0134e46 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -472,17 +472,21 @@ slot_proxy_drag_data_received (GtkWidget *widget,
drag_info = user_data;
g_assert (!drag_info->have_data);
-
- drag_info->have_data = TRUE;
- drag_info->info = info;
drag_info->waiting_for_data = FALSE;
if (gtk_selection_data_get_length (data) < 0)
{
- drag_info->have_valid_data = FALSE;
+ /* Data retrieval failed. */
+ if (drag_info->drop_occurred)
+ {
+ gtk_drag_finish (context, FALSE, FALSE, time);
+ }
return;
}
+ drag_info->have_data = TRUE;
+ drag_info->info = info;
+
if (info == NAUTILUS_ICON_DND_GNOME_ICON_LIST)
{
drag_info->data.selection_list = nautilus_drag_build_selection_list (data);