diff options
author | António Fernandes <antoniof@gnome.org> | 2021-07-16 22:47:40 +0100 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2022-03-19 16:48:54 +0000 |
commit | 51594105bc59f6197e2b176b6c132a3ac8a156c0 (patch) | |
tree | 8f8fa17529f02f563e5222a8456bb27c483d1b80 | |
parent | 095d88295e6a7a5fefdcb58e1483ae3926b8cb1c (diff) | |
download | nautilus-51594105bc59f6197e2b176b6c132a3ac8a156c0.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.c | 12 |
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); |