summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Sanchez Prada <mario@endlessm.com>2016-05-05 16:18:25 +0100
committerMario Sanchez Prada <mario@mariospr.org>2016-05-05 16:28:34 +0100
commit5ae6b6817cdf31a23eac109295a86f3e8b00efd2 (patch)
tree0edff9937c354ddc6fa1f6c8b0a1141730d7cb3c
parentebdc9575a5e673b5117f354208e7a07c2d134863 (diff)
downloadnautilus-5ae6b6817cdf31a23eac109295a86f3e8b00efd2.tar.gz
file-operations: Use a GList** for the to_delete output parameter
The to_delete GList* gets initialized in trash_files() and is supposed to be filled by trash_file() so that we know which files we want to delete directly when the call to g_file_trash() fails for some reason. However, this GList* gets modified in place by calls to g_list_prepend() and so those changes will only be seen by the to_delete argument inside trash_file(), but not by the local variable defined in trash_files(), which will continue to point to NULL regardless of those changes. So, we simply need to pass a reference to the GList* so that any change done to the structure of the GList* inside trash_file() is seen in trash_files(). https://bugzilla.gnome.org/show_bug.cgi?id=766030
-rw-r--r--src/nautilus-file-operations.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index e25c260fd..4076c99f6 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -2002,7 +2002,7 @@ trash_file (CommonJob *job,
SourceInfo *source_info,
TransferInfo *transfer_info,
gboolean toplevel,
- GList *to_delete)
+ GList **to_delete)
{
GError *error;
char *primary, *secondary, *details;
@@ -2033,7 +2033,7 @@ trash_file (CommonJob *job,
}
if (job->delete_all) {
- to_delete = g_list_prepend (to_delete, file);
+ *to_delete = g_list_prepend (*to_delete, file);
goto skip;
}
@@ -2065,10 +2065,10 @@ trash_file (CommonJob *job,
*skipped_file = TRUE;
job->skip_all_error = TRUE;
} else if (response == 3) { /* delete all */
- to_delete = g_list_prepend (to_delete, file);
+ *to_delete = g_list_prepend (*to_delete, file);
job->delete_all = TRUE;
} else if (response == 4) { /* delete */
- to_delete = g_list_prepend (to_delete, file);
+ *to_delete = g_list_prepend (*to_delete, file);
}
skip:
@@ -2114,7 +2114,7 @@ trash_files (CommonJob *job,
trash_file (job, file,
&skipped_file,
&source_info, &transfer_info,
- TRUE, to_delete);
+ TRUE, &to_delete);
if (skipped_file) {
(*files_skipped)++;
}