From 127feaea2d4ffd62666673f99e73153857a7e63e Mon Sep 17 00:00:00 2001 From: ericek111 Date: Wed, 25 Nov 2020 10:50:46 +0100 Subject: file-operations: don't attempt to move into the source dir --- libcaja-private/caja-file-operations.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libcaja-private/caja-file-operations.c') diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 017aa5cb..e6dcdb98 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -5882,6 +5882,7 @@ caja_file_operations_copy_move (const GList *item_uris, { GList *locations; GList *p; + GFile *src_dir; GFile *dest; GtkWindow *parent_window; gboolean target_is_mapping; @@ -5918,10 +5919,9 @@ caja_file_operations_copy_move (const GList *item_uris, parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW); } - if (copy_action == GDK_ACTION_COPY) { - GFile *src_dir; + src_dir = g_file_get_parent (locations->data); - src_dir = g_file_get_parent (locations->data); + if (copy_action == GDK_ACTION_COPY) { if (target_dir == NULL || (src_dir != NULL && g_file_equal (src_dir, dest))) { @@ -5936,10 +5936,6 @@ caja_file_operations_copy_move (const GList *item_uris, parent_window, done_callback, done_callback_data); } - if (src_dir) { - g_object_unref (src_dir); - } - } else if (copy_action == GDK_ACTION_MOVE) { if (g_file_has_uri_scheme (dest, "trash")) { MoveTrashCBData *cb_data; @@ -5951,7 +5947,7 @@ caja_file_operations_copy_move (const GList *item_uris, parent_window, (CajaDeleteCallback) callback_for_move_to_trash, cb_data); - } else { + } else if (src_dir == NULL || !g_file_equal (src_dir, dest)) { caja_file_operations_move (locations, relative_item_points, dest, @@ -5970,6 +5966,10 @@ caja_file_operations_copy_move (const GList *item_uris, if (dest) { g_object_unref (dest); } + + if (src_dir) { + g_object_unref (src_dir); + } } static gboolean -- cgit v1.2.1