From b00cccb74307a49df74deb785936e3cd9cf3a5ad Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Fri, 23 Nov 2012 11:18:34 +0200 Subject: [all] include src/glibcompat.h & use g_list_free_full() where needed Also fixes a double-free regression in lc-p/caja-query from 7a42b9b0 --- libcaja-private/caja-file-operations.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 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 067f52d5..baaa8843 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -68,6 +68,8 @@ #include "caja-file-conflict-dialog.h" #include "caja-undostack-manager.h" +#include /* for g_list_free_full */ + /* TODO: TESTING!!! */ typedef struct { @@ -1858,8 +1860,7 @@ delete_job_done (gpointer user_data) job = user_data; - g_list_foreach(job->files, (GFunc) g_object_unref, NULL); - g_list_free(job->files); + g_list_free_full (job->files, g_object_unref); if (job->done_callback) { debuting_uris = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL); @@ -2188,8 +2189,7 @@ has_trash_files (GMount *mount) } } - g_list_foreach(dirs, (GFunc) g_object_unref, NULL); - g_list_free(dirs); + g_list_free_full (dirs, g_object_unref); return res; } @@ -4462,8 +4462,7 @@ copy_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - g_list_foreach(job->files, (GFunc) g_object_unref, NULL); - g_list_free(job->files); + g_list_free_full (job->files, g_object_unref); if (job->destination) { g_object_unref (job->destination); } @@ -4990,8 +4989,7 @@ move_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - g_list_foreach(job->files, (GFunc) g_object_unref, NULL); - g_list_free(job->files); + g_list_free_full (job->files, g_object_unref); g_object_unref (job->destination); g_hash_table_unref (job->debuting_files); g_free (job->icon_positions); @@ -5071,8 +5069,7 @@ move_job (GIOSchedulerJob *io_job, &source_info, &transfer_info); aborted: - g_list_foreach(fallbacks, (GFunc) g_free, NULL); - g_list_free(fallbacks); + g_list_free_full (fallbacks, g_free); g_free (dest_fs_id); g_free (dest_fs_type); @@ -5326,8 +5323,7 @@ link_job_done (gpointer user_data) job->done_callback (job->debuting_files, job->done_callback_data); } - g_list_foreach(job->files, (GFunc) g_object_unref, NULL); - g_list_free(job->files); + g_list_free_full (job->files, g_object_unref); g_object_unref (job->destination); g_hash_table_unref (job->debuting_files); g_free (job->icon_positions); @@ -5779,8 +5775,7 @@ caja_file_operations_copy_move (const GList *item_uris, done_callback, done_callback_data); } - g_list_foreach(locations, (GFunc) g_object_unref, NULL); - g_list_free(locations); + g_list_free_full (locations, g_object_unref); if (dest) { g_object_unref (dest); } @@ -6258,8 +6253,7 @@ empty_trash_job_done (gpointer user_data) job = user_data; - g_list_foreach(job->trash_dirs, (GFunc) g_object_unref, NULL); - g_list_free(job->trash_dirs); + g_list_free_full (job->trash_dirs, g_object_unref); if (job->done_callback) { job->done_callback (job->done_callback_data); -- cgit v1.2.1