[nautilus] batch-rename: Fix memory leaks
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] batch-rename: Fix memory leaks
- Date: Tue, 11 Oct 2016 17:10:08 +0000 (UTC)
commit 045d04aaade157132640999a1b033c931e0d37e2
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date: Fri Oct 7 12:03:39 2016 +0300
batch-rename: Fix memory leaks
Fix memory leaks for batch renaming.
https://bugzilla.gnome.org/show_bug.cgi?id=772434
src/nautilus-batch-rename-dialog.c | 15 +++++++++++++++
src/nautilus-batch-rename-utilities.c | 8 +++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index ba6e7ef..e135f64 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -379,6 +379,10 @@ split_entry_text (NautilusBatchRenameDialog *self,
{
result = g_list_prepend (result, normal_text);
}
+ else
+ {
+ g_string_free (normal_text, TRUE);
+ }
for (l = tag_info_keys; l != NULL; l = l->next)
{
@@ -731,6 +735,7 @@ prepare_batch_rename (NautilusBatchRenameDialog *dialog)
if (dialog->conflict_cancellable)
{
g_cancellable_cancel (dialog->conflict_cancellable);
+ g_clear_object (&dialog->conflict_cancellable);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -750,6 +755,7 @@ batch_rename_dialog_on_response (NautilusBatchRenameDialog *dialog,
if (dialog->conflict_cancellable)
{
g_cancellable_cancel (dialog->conflict_cancellable);
+ g_clear_object (&dialog->conflict_cancellable);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -1234,6 +1240,7 @@ on_file_names_list_has_duplicates (GObject *object,
if (!success)
{
+ g_clear_error (&error);
return;
}
@@ -1354,6 +1361,8 @@ destroy_conflicts_task_data (gpointer data)
g_list_free (task_data->directories);
}
+ g_free (task_data);
+
g_mutex_clear (&task_data->wait_ready_mutex);
g_cond_clear (&task_data->wait_ready_condition);
}
@@ -1509,6 +1518,7 @@ update_display_text (NautilusBatchRenameDialog *dialog)
if (dialog->conflict_cancellable != NULL)
{
g_cancellable_cancel (dialog->conflict_cancellable);
+ g_clear_object (&dialog->conflict_cancellable);
}
if(dialog->selection == NULL)
@@ -2051,6 +2061,7 @@ nautilus_batch_rename_dialog_finalize (GObject *object)
}
}
+ g_string_free (file_metadata->file_name, TRUE);
g_free (file_metadata);
}
@@ -2065,6 +2076,10 @@ nautilus_batch_rename_dialog_finalize (GObject *object)
nautilus_file_list_free (dialog->selection);
nautilus_directory_unref (dialog->directory);
+ g_object_unref (dialog->size_group);
+
+ g_hash_table_destroy (dialog->tag_info_table);
+
G_OBJECT_CLASS (nautilus_batch_rename_dialog_parent_class)->finalize (object);
}
diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c
index 4d55109..95fd358 100644
--- a/src/nautilus-batch-rename-utilities.c
+++ b/src/nautilus-batch-rename-utilities.c
@@ -716,6 +716,8 @@ on_cursor_callback (GObject *object,
query_data->date_order_hash_table,
query_data->selection_metadata);
+ g_free (query_data);
+
return;
}
@@ -877,6 +879,8 @@ batch_rename_dialog_query_callback (GObject *object,
nautilus_batch_rename_dialog_query_finished (query_data->dialog,
query_data->date_order_hash_table,
query_data->selection_metadata);
+
+ g_free (query_data);
}
else
{
@@ -955,11 +959,13 @@ check_metadata_for_selection (NautilusBatchRenameDialog *dialog,
file_metadata->file_name = g_string_new (file_name);
file_metadata->metadata[ORIGINAL_FILE_NAME] = g_string_new (file_name);
- selection_metadata = g_list_append (selection_metadata, file_metadata);
+ selection_metadata = g_list_prepend (selection_metadata, file_metadata);
g_free (file_name);
}
+ selection_metadata = g_list_reverse (selection_metadata);
+
g_string_append (query, "} ORDER BY ASC(nie:contentCreated(?file))");
connection = tracker_sparql_connection_get (NULL, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]