You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nautilus/SOURCES/window-slot-dnd-Fix-data-re...

51 lines
1.6 KiB

From 51594105bc59f6197e2b176b6c132a3ac8a156c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ant=C3=B3nio=20Fernandes?= <antoniof@gnome.org>
Date: Fri, 16 Jul 2021 22:47:40 +0100
Subject: [PATCH] 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.
---
src/nautilus-window-slot-dnd.c | 12 ++++++++----
1 file 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);
--
2.41.0