[nautilus/alex-fazakas-duplicate-warning: 2/3] file-operations: Fix undo-duplicate critical



commit 06a5ea18cab2bd16402e1f6269c57af1faaa9c5c
Author: Alexandru Fazakas <alex fazakas97 gmail com>
Date:   Wed Jul 25 14:40:50 2018 +0300

    file-operations: Fix undo-duplicate critical
    
    While the undo information is set inside the duplicate function, the
    copy one also tries setting it, creating a critical warning due to
    the target directory being NULL.
    
    This patch solves this issue by setting the undo info only if it
    hasn't already been set.

 src/nautilus-file-operations.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 4ae4ca383..d6eaef837 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -5778,9 +5778,15 @@ nautilus_file_operations_copy (GTask        *task,
         GFile *src_dir;
 
         src_dir = g_file_get_parent (job->files->data);
-        job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_COPY,
-                                                                 g_list_length (job->files),
-                                                                 src_dir, job->destination);
+        /* In the case of duplicate, the undo_info is already set, so we don't want to
+         * overwrite it wrongfully.
+         */
+        if (job->common.undo_info != NULL)
+        {
+            job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_COPY,
+                                                                     g_list_length (job->files),
+                                                                     src_dir, job->destination);
+        }
 
         g_object_unref (src_dir);
     }


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