[nautilus/gnome-3-30] application: Check pending location on clone-window
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-30] application: Check pending location on clone-window
- Date: Wed, 14 Nov 2018 18:04:56 +0000 (UTC)
commit 3a5d1c54e34c592230150a705d07e52caad72c39
Author: Ernestas Kulik <ernestask gnome org>
Date: Tue Sep 25 06:26:00 2018 +0000
application: Check pending location on clone-window
Cloning the window while its location is null (i.e. the attributes of
the pending location file are still being waited on) results in a failed
assertion, which is less than desirable. That can be fixed by
preemptively checking if there is a pending location on the slot and
using that in the new window.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/649
(cherry picked from commit d6f61a88237bc1396f1f054393a16e1425f59445)
src/nautilus-application.c | 12 ++++++++++++
src/nautilus-window-slot.c | 13 ++++++++++++-
src/nautilus-window-slot.h | 1 +
3 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index cceab8705..b0893f344 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -744,7 +744,19 @@ action_clone_window (GSimpleAction *action,
}
else
{
+ /* If the user happens to fall asleep while holding ctrl-n, or very
+ * unfortunately opens a new window at a remote location, the current
+ * location will be null, leading to criticals and/or failed assertions.
+ *
+ * Another sad thing is that checking if the view/slot is loading will
+ * not work, as the loading process only really begins after the attributes
+ * for the file have been fetched.
+ */
location = nautilus_window_slot_get_location (active_slot);
+ if (location == NULL)
+ {
+ location = nautilus_window_slot_get_pending_location (active_slot);
+ }
}
nautilus_application_open_location_full (NAUTILUS_APPLICATION (application), location,
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index a455785db..f221d0c8e 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1884,7 +1884,6 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
NautilusFile *viewed_file;
NautilusView *view;
GFile *location;
-
NautilusApplication *app;
self = callback_data;
@@ -3257,6 +3256,18 @@ nautilus_window_slot_get_location (NautilusWindowSlot *self)
return priv->location;
}
+GFile *
+nautilus_window_slot_get_pending_location (NautilusWindowSlot *self)
+{
+ NautilusWindowSlotPrivate *priv;
+
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (self), NULL);
+
+ priv = nautilus_window_slot_get_instance_private (self);
+
+ return priv->pending_location;
+}
+
const gchar *
nautilus_window_slot_get_title (NautilusWindowSlot *self)
{
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index e2e0d7592..b4f15b04a 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -77,6 +77,7 @@ void nautilus_window_slot_open_location_full (NautilusWindowSlot
GList *new_selection);
GFile * nautilus_window_slot_get_location (NautilusWindowSlot *slot);
+GFile * nautilus_window_slot_get_pending_location (NautilusWindowSlot *slot);
NautilusBookmark *nautilus_window_slot_get_bookmark (NautilusWindowSlot *slot);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]