[nautilus] nautilus-file: copy parameter data in batch renaming



commit a508adbb900678c8c401155cf5fed3ee0959b88b
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Sep 21 20:21:29 2016 +0200

    nautilus-file: copy parameter data in batch renaming
    
    We need to have our own copy and ownership of the parameter data,
    if not later on when we do async operations the data might be already
    freed.
    
    This was making batch rename crash every time.
    
    This is to follow the common pattern of not transferring the ownership
    from caller to called.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770586

 src/nautilus-file.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 3ef33e1..f9ca890 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -1851,11 +1851,7 @@ nautilus_file_operation_free (NautilusFileOperation *op)
     }
     else
     {
-        for (l = op->files; l != NULL; l = l->next)
-        {
-            file = NAUTILUS_FILE (l->data);
-            nautilus_file_unref (file);
-        }
+        nautilus_file_list_free (op->files);
     }
 
     g_object_unref (op->cancellable);
@@ -2277,7 +2273,7 @@ real_batch_rename (GList                         *files,
 
     /* Set up a batch renaming operation. */
     op = nautilus_file_operation_new (files->data, callback, callback_data);
-    op->files = files;
+    op->files = nautilus_file_list_copy (files);
     op->renamed_files = 0;
     op->skipped_files = 0;
 


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