[nautilus/790-freeze-when-restoring-file-from-trash-if-file-with-same-name-and-location-exists: 2/2] file-utilities: Don't block main thread to restore from trash




commit 9fc4fa993e2feec050c593fe795ca3c2cbd6ebb0
Author: António Fernandes <antoniof gnome org>
Date:   Sun Sep 13 13:25:24 2020 +0100

    file-utilities: Don't block main thread to restore from trash
    
    The sync variants of file operations have been introduced for use in
    integration tests. The async operations have been suffixed _async().
    
    However, likely by mistake, in the restore from trash operation, the
    call has been appended _sync rather than _async. [1]
    
    This blocks the main thread until the operation task finishes, causing
    a dead lock when the operation thread needs the main thread to show a
    conflict dialog. This happens when restoring a file from trash if a new
    file with the same name already exists in the original location.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/790
    
    [1] commit ab31018cdaeb1c592e1c46402c5ae1facc503151

 src/nautilus-file-utilities.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
index e6a4b2e58..2ee6e7c05 100644
--- a/src/nautilus-file-utilities.c
+++ b/src/nautilus-file-utilities.c
@@ -818,9 +818,10 @@ ensure_dirs_task_ready_cb (GObject      *_source,
         files = g_hash_table_lookup (data->original_dirs_hash, original_dir);
         locations = locations_from_file_list (files);
 
-        nautilus_file_operations_move_sync
-            (locations,
-            original_dir_location);
+        nautilus_file_operations_move_async (locations,
+                                             original_dir_location,
+                                             data->parent_window,
+                                             NULL, NULL, NULL);
 
         g_list_free_full (locations, g_object_unref);
         g_object_unref (original_dir_location);


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