diff options
author | Jasmine Hassan <[email protected]> | 2012-11-23 11:18:34 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-23 11:18:34 +0200 |
commit | b00cccb74307a49df74deb785936e3cd9cf3a5ad (patch) | |
tree | f2bcc459a2bef12678e642d0a14ce7f02373b71d /libcaja-private/caja-undostack-manager.c | |
parent | b12a7f6ea3309ecddfc7e3ae839a7b558c862533 (diff) | |
download | caja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.bz2 caja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.xz |
[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
Diffstat (limited to 'libcaja-private/caja-undostack-manager.c')
-rw-r--r-- | libcaja-private/caja-undostack-manager.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c index 0a19934e..08dd827e 100644 --- a/libcaja-private/caja-undostack-manager.c +++ b/libcaja-private/caja-undostack-manager.c @@ -34,6 +34,8 @@ #include <locale.h> #include <gdk/gdk.h> +#include <src/glibcompat.h> /* for g_list_free_full */ + /* ***************************************************************** Private fields ***************************************************************** */ @@ -431,8 +433,7 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_copy (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_CREATEFILEFROMTEMPLATE: puri = get_uri_parent (action->target_uri); @@ -448,16 +449,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_duplicate (uris, NULL, NULL, undo_redo_done_transfer_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_RESTOREFROMTRASH: case CAJA_UNDOSTACK_MOVE: uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_move (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_RENAME: new_name = get_uri_basename (action->new_uri); @@ -491,16 +490,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, caja_file_operations_trash_or_delete (uris, NULL, undo_redo_done_delete_callback, action); g_list_free (uri_to_trash); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); } break; case CAJA_UNDOSTACK_CREATELINK: uris = construct_gfile_list (action->sources, action->src_dir); caja_file_operations_link (uris, NULL, action->dest_dir, NULL, undo_redo_done_transfer_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_SETPERMISSIONS: file = caja_file_get_by_uri (action->target_uri); @@ -583,8 +580,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, if (priv->confirm_delete) { caja_file_operations_delete (uris, NULL, undo_redo_done_delete_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); } else { /* We skip the confirmation message */ @@ -605,8 +601,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->destinations, action->dest_dir); caja_file_operations_trash_or_delete (uris, NULL, undo_redo_done_delete_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_MOVETOTRASH: files_to_restore = retrieve_files_to_restore (action->trashed); @@ -636,8 +631,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, uris = construct_gfile_list (action->destinations, action->dest_dir); caja_file_operations_move (uris, NULL, action->src_dir, NULL, undo_redo_done_transfer_callback, action); - g_list_foreach(uris, (GFunc) g_object_unref, NULL); - g_list_free(uris); + g_list_free_full (uris, g_object_unref); break; case CAJA_UNDOSTACK_RENAME: new_name = get_uri_basename (action->old_uri); @@ -1766,12 +1760,10 @@ free_undostack_action (gpointer data, gpointer user_data) g_free (action->new_user_name_or_id); if (action->sources) { - g_list_foreach (action->sources, (GFunc) g_free, NULL); - g_list_free (action->sources); + g_list_free_full (action->sources, g_free); } if (action->destinations) { - g_list_foreach (action->destinations, (GFunc) g_free, NULL); - g_list_free (action->destinations); + g_list_free_full (action->destinations, g_free); } if (action->trashed) { |