From 7e166bdaf227218a1e7e1459ff090f465188ab74 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Thu, 28 Mar 2024 17:54:47 +0300 Subject: [PATCH] import nautilus-40.2-15.el9 --- ...-dnd-Fix-data-retrieval-failure-path.patch | 50 ++++++++++++ ...nd-Ignore-data-not-received-on-hover.patch | 65 ++++++++++++++++ ...slot-dnd-Stop-queueing-data-requests.patch | 76 +++++++++++++++++++ SPECS/nautilus.spec | 18 ++--- 4 files changed, 199 insertions(+), 10 deletions(-) create mode 100644 SOURCES/window-slot-dnd-Fix-data-retrieval-failure-path.patch create mode 100644 SOURCES/window-slot-dnd-Ignore-data-not-received-on-hover.patch create mode 100644 SOURCES/window-slot-dnd-Stop-queueing-data-requests.patch diff --git a/SOURCES/window-slot-dnd-Fix-data-retrieval-failure-path.patch b/SOURCES/window-slot-dnd-Fix-data-retrieval-failure-path.patch new file mode 100644 index 0000000..1f10870 --- /dev/null +++ b/SOURCES/window-slot-dnd-Fix-data-retrieval-failure-path.patch @@ -0,0 +1,50 @@ +From 51594105bc59f6197e2b176b6c132a3ac8a156c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ant=C3=B3nio=20Fernandes?= +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 + diff --git a/SOURCES/window-slot-dnd-Ignore-data-not-received-on-hover.patch b/SOURCES/window-slot-dnd-Ignore-data-not-received-on-hover.patch new file mode 100644 index 0000000..f88ebdf --- /dev/null +++ b/SOURCES/window-slot-dnd-Ignore-data-not-received-on-hover.patch @@ -0,0 +1,65 @@ +From 9f36eaa6f4e7757b7cdf41a54cfc9f03eaa0ce89 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ant=C3=B3nio=20Fernandes?= +Date: Fri, 16 Jul 2021 23:25:22 +0100 +Subject: [PATCH] window-slot-dnd: Ignore data not received on hover + +Sometimes, after having called gtk_drag_get_data() on ::drag-motion, we +only get the data after ::drag-leave. + +This is fine if the ::drag-leave is followed by ::drag-drop. Otherwise, +as ::drag-leave is responsible for cleanup, data arriving afterwards is +leaking into the next time content is dragged hover the widget, even if +the dragged content is no longer the same. + +Instead, keep track of the hover status and don't save data that's no +longer relevant. +--- + src/nautilus-window-slot-dnd.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c +index ec0134e46..772a8bb88 100644 +--- a/src/nautilus-window-slot-dnd.c ++++ b/src/nautilus-window-slot-dnd.c +@@ -36,6 +36,7 @@ typedef struct + gboolean have_data; + gboolean have_valid_data; + ++ gboolean is_hover; + gboolean drop_occurred; + + unsigned int info; +@@ -170,6 +171,8 @@ slot_proxy_drag_motion (GtkWidget *widget, + + drag_info = user_data; + ++ drag_info->is_hover = TRUE; ++ + action = 0; + valid_text_drag = FALSE; + valid_xds_drag = FALSE; +@@ -335,6 +338,7 @@ slot_proxy_drag_leave (GtkWidget *widget, + + drag_info = user_data; + ++ drag_info->is_hover = FALSE; + gtk_drag_unhighlight (widget); + drag_info_clear (drag_info); + } +@@ -474,6 +478,13 @@ slot_proxy_drag_data_received (GtkWidget *widget, + g_assert (!drag_info->have_data); + drag_info->waiting_for_data = FALSE; + ++ if (!drag_info->is_hover && !drag_info->drop_occurred) ++ { ++ /* Ignore data arriving after ::drag-leave, except if followed by ++ * ::drag-drop. */ ++ return; ++ } ++ + if (gtk_selection_data_get_length (data) < 0) + { + /* Data retrieval failed. */ +-- +2.41.0 + diff --git a/SOURCES/window-slot-dnd-Stop-queueing-data-requests.patch b/SOURCES/window-slot-dnd-Stop-queueing-data-requests.patch new file mode 100644 index 0000000..1a8b0d0 --- /dev/null +++ b/SOURCES/window-slot-dnd-Stop-queueing-data-requests.patch @@ -0,0 +1,76 @@ +From 095d88295e6a7a5fefdcb58e1483ae3926b8cb1c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ant=C3=B3nio=20Fernandes?= +Date: Fri, 16 Jul 2021 22:32:41 +0100 +Subject: [PATCH] window-slot-dnd: Stop queueing data requests + +Each time ::drag-motion is emitted, we call gtk_drag_get_data() if we +don't have data yet. + +If the drag source doesn't provide the data right away, we can end up +calling gtk_drag_get_data() multiple times. Later, when the data is +retrieved, we get multiple ::drag-data-received emissions. + +Not only is this wasteful, it also breaks an assertion, causing crashes. + +Instead, make sure gtk_drag_get_data() is called only once. + +Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1535 +--- + src/nautilus-window-slot-dnd.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c +index 96c5d9cc8..9509d2c97 100644 +--- a/src/nautilus-window-slot-dnd.c ++++ b/src/nautilus-window-slot-dnd.c +@@ -32,6 +32,7 @@ + + typedef struct + { ++ gboolean waiting_for_data; + gboolean have_data; + gboolean have_valid_data; + +@@ -181,7 +182,7 @@ slot_proxy_drag_motion (GtkWidget *widget, + window = gtk_widget_get_toplevel (widget); + g_assert (NAUTILUS_IS_WINDOW (window)); + +- if (!drag_info->have_data) ++ if (!drag_info->have_data && !drag_info->waiting_for_data) + { + target = gtk_drag_dest_find_target (widget, context, NULL); + +@@ -190,6 +191,7 @@ slot_proxy_drag_motion (GtkWidget *widget, + goto out; + } + ++ drag_info->waiting_for_data = TRUE; + gtk_drag_get_data (widget, context, target, time); + } + +@@ -353,8 +355,12 @@ slot_proxy_drag_drop (GtkWidget *widget, + + drag_info->drop_occurred = TRUE; + +- target = gtk_drag_dest_find_target (widget, context, NULL); +- gtk_drag_get_data (widget, context, target, time); ++ if (!drag_info->waiting_for_data) ++ { ++ target = gtk_drag_dest_find_target (widget, context, NULL); ++ drag_info->waiting_for_data = TRUE; ++ gtk_drag_get_data (widget, context, target, time); ++ } + + return TRUE; + } +@@ -469,6 +475,7 @@ slot_proxy_drag_data_received (GtkWidget *widget, + + drag_info->have_data = TRUE; + drag_info->info = info; ++ drag_info->waiting_for_data = FALSE; + + if (gtk_selection_data_get_length (data) < 0) + { +-- +2.41.0 + diff --git a/SPECS/nautilus.spec b/SPECS/nautilus.spec index ae22128..ac0fa83 100644 --- a/SPECS/nautilus.spec +++ b/SPECS/nautilus.spec @@ -6,7 +6,7 @@ Name: nautilus Version: 40.2 -Release: 14%{?dist}.inferit.1 +Release: 15%{?dist}.inferit Summary: File manager for GNOME License: GPLv3+ @@ -49,6 +49,10 @@ Patch20: window-slot-Fix-conditions-to-restore-selection-when.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2120263 Patch21: file-Generate-thumbnails-when-the-preview-icon-is-av.patch +# https://issues.redhat.com/browse/RHEL-12820 +Patch: window-slot-dnd-Stop-queueing-data-requests.patch +Patch: window-slot-dnd-Fix-data-retrieval-failure-path.patch +Patch: window-slot-dnd-Ignore-data-not-received-on-hover.patch # MSVSphere Patch1000: 0001-Update-Russian-translation.patch @@ -182,17 +186,11 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %doc %{_datadir}/gtk-doc/html/libnautilus-extension/ %changelog -* Mon Feb 19 2024 Sergey Cherevko - 40.2-14.inferit.1 +* Tue Apr 2 2024 Arkady L. Shane - 40.2-15.inferit - Update Russian translation -- Bump version -* Tue Oct 10 2023 Sergey Cherevko - 40.2-14.inferit -- Update Russian translation -- Rebuilt for MSVSphere 9.3 - -* Thu Jul 20 2023 Sergey Cherevko - 40.2-11.inferit.1 -- Fixed Russian translation -- Rebuilt for MSVSphere 9.2 +* Wed Oct 18 2023 Ondrej Holy - 40.2-15 +- Fix crashes when dragging from another application (RHEL-12820) * Wed Jun 14 2023 Ondrej Holy - 40.2-14 - Force reload current location when it reappears (#2184292)