[nautilus/gnome-3-18] window-slot: invalidate file attributes on reload
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-18] window-slot: invalidate file attributes on reload
- Date: Fri, 11 Dec 2015 22:17:14 +0000 (UTC)
commit b8d8973e5a2b8f9a4522980d6ee2adadd64319c1
Author: Carlos Soriano <csoriano gnome org>
Date: Fri Dec 11 22:33:52 2015 +0100
window-slot: invalidate file attributes on reload
Files attributes in nautilus are cached, and sometimes having a cached
value its problematic for special cases like mounting due to how window
slot mounts locations, which relies in the file not having the mount
information ready, which is not true when the file doesn't get
finalized and doesn't get acknowledge by the volume monitor when its
root gets unmounted.
To avoid that, invalidate all file attributes when changing locations.
A better solution for this specific case would be to make the root
volume monitor to acknowledge all its children when unmounted, and keep
it alive as long as there are children.
But this fix is anyway needed since previous 3.18 is how it was done and
seems it's a needed for now "workaround all" issues with cached values.
https://bugzilla.gnome.org/show_bug.cgi?id=757555
src/nautilus-window-slot.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 4797b91..0a7437a 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -841,6 +841,7 @@ check_force_reload (GFile *location,
NautilusLocationChangeType type)
{
NautilusDirectory *directory;
+ NautilusFile *file;
gboolean force_reload;
/* The code to force a reload is here because if we do it
@@ -848,6 +849,7 @@ check_force_reload (GFile *location,
* we end up fetching things twice.
*/
directory = nautilus_directory_get (location);
+ file = nautilus_file_get (location);
if (type == NAUTILUS_LOCATION_CHANGE_RELOAD) {
force_reload = TRUE;
@@ -857,11 +859,16 @@ check_force_reload (GFile *location,
force_reload = !nautilus_directory_is_local (directory);
}
+ /* We need to invalidate file attributes as well due to how mounting works
+ * in the window slot and to avoid other caching issues.
+ * Read handle_mount_if_needed for one example */
if (force_reload) {
+ nautilus_file_invalidate_all_attributes (file);
nautilus_directory_force_reload (directory);
}
nautilus_directory_unref (directory);
+ nautilus_file_unref (file);
}
static void
@@ -1207,6 +1214,23 @@ nautilus_window_slot_display_view_selection_failure (NautilusWindow *window,
g_free (detail_message);
}
+/* FIXME: This works in the folowwing way. begin_location_change tries to get the
+ * information of the file directly.
+ * If the nautilus file finds that there is an error trying to get its
+ * information and the error match that the file is not mounted, it sets an
+ * internal attribute with the error then we try to mount it here.
+ *
+ * However, files are cached, and if the file doesn't get finalized in a location
+ * change, because needs to be in the navigation history or is a bookmark, and the
+ * file is not the root of the mount point, which is tracked by a volume monitor,
+ * and it gets unmounted aftwerwards, the file doesn't realize it's unmounted, and
+ * therefore this trick to open an unmounted file will fail the next time the user
+ * tries to open.
+ * For that, we need to always invalidate the file attributes when a location is
+ * changed, which is done in check_force_reload.
+ * A better way would be to make sure any children of the mounted root gets
+ * akwnoledge by it either by adding a reference to its parent volume monitor
+ * or with another solution. */
static gboolean
handle_mount_if_needed (NautilusWindowSlot *slot,
NautilusFile *file)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]