[nautilus/slot-close-on-location-change-failure: 6/6] window-slot: Go home instead of closing slot on failure



commit 970ff5c0b746b59610ca3bdee05683d4ae4cc4d4
Author: Ernestas Kulik <ernestask gnome org>
Date:   Wed Aug 1 18:30:42 2018 +0300

    window-slot: Go home instead of closing slot on failure
    
    Currently, the window slot is closed if there happens to be a failure
    while changing location. Additionally, that causes a crash in Mutter on
    Wayland, likely due to very unfortunate timing of opening a transient
    dialog and closing the window.
    The issue can be fixed by going home, instead, when there is an error.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/562

 src/nautilus-window-slot.c | 27 ++++++++++++++++++++++++---
 src/nautilus-window.c      |  6 ++++--
 2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 90069cbde..0fbb9818d 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1987,11 +1987,32 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
             end_location_change (self);
             slot_location = nautilus_window_slot_get_location (self);
 
-            /* We're missing a previous location (if opened location
-             * in a new tab) so close it and return */
+            /* XXX FIXME VOODOO TODO:
+             * Context: https://gitlab.gnome.org/GNOME/nautilus/issues/562
+             * (and the associated MR)
+             *
+             * This used to just close the slot, which, in combination with
+             * the transient error dialog, caused Mutter to have a heart attack
+             * and die when the slot happened to be the only one remaining.
+             * The following condition can hold true in (at least) two cases:
+             *
+             * 1. We are inside the “Other Locations” view and are opening
+             *    a broken bookmark, which causes the window slot to get replaced
+             *    with one that handles the location, and is, understandably,
+             *    empty.
+             * 2. We open a broken bookmark in a new window, which works almost
+             *    the same, in that it has no open location.
+             *
+             * Ernestas: I’m leaning towards having an in-view message about the
+             *           failure, which avoids dialogs and magically disappearing
+             *           slots/tabs/windows (also allowing to go back to the
+             *           previous location), but a dialog is quicker to inform
+             *           about the failure.
+             * XXX
+             */
             if (slot_location == NULL)
             {
-                nautilus_window_slot_close (window, self);
+                nautilus_window_slot_go_home (self, 0);
             }
             else
             {
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 824bdf0b1..6bef2065b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -909,6 +909,7 @@ open_location_cb (NautilusWindow     *window,
                   GtkPlacesOpenFlags  open_flags)
 {
     NautilusWindowOpenFlags flags;
+    NautilusApplication *application;
 
     switch (open_flags)
     {
@@ -933,11 +934,12 @@ open_location_cb (NautilusWindow     *window,
         break;
     }
 
+    application = NAUTILUS_APPLICATION (g_application_get_default ());
     /* FIXME: We shouldn't need to provide the window, but seems gtk_application_get_active_window
      * is not working properly in GtkApplication, so we cannot rely on that...
      */
-    nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
-                                             location, flags, NULL, window, NULL);
+    nautilus_application_open_location_full (application, location, flags,
+                                             NULL, window, NULL);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]