[nautilus] file: clear info before removing from directory



commit d1876bd6fb7a5e62be0f6f8b5baf743024cfd1c7
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sun Jul 30 11:20:29 2017 +0100

    file: clear info before removing from directory
    
    When marking the file as gone, clearing its file info after removing it
    from the parent directory will result in a crash in cases where it is
    the last reference being dropped.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785562

 src/nautilus-file.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 0b35f62..8758958 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -8448,6 +8448,11 @@ nautilus_file_mark_gone (NautilusFile *file)
     /* Drop it from the symlink hash ! */
     remove_from_link_hash_table (file);
 
+    /* Removing the file from the directory can result in dropping the last
+     * reference, and so clearing the info then will result in a crash.
+     */
+    nautilus_file_clear_info (file);
+
     /* Let the directory know it's gone. */
     directory = file->details->directory;
     if (!nautilus_file_is_self_owned (file))
@@ -8455,8 +8460,6 @@ nautilus_file_mark_gone (NautilusFile *file)
         nautilus_directory_remove_file (directory, file);
     }
 
-    nautilus_file_clear_info (file);
-
     /* FIXME bugzilla.gnome.org 42429:
      * Maybe we can get rid of the name too eventually, but
      * for now that would probably require too many if statements


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