[gtk/gbsneto/filechooser-column-view: 94/161] filesystemmodel: Use g_clear_* on finalize
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gbsneto/filechooser-column-view: 94/161] filesystemmodel: Use g_clear_* on finalize
- Date: Thu, 20 Oct 2022 19:22:24 +0000 (UTC)
commit 356ca7817f2ab23224afc9a582c7d73efbab7a1a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Oct 7 17:12:05 2022 -0300
filesystemmodel: Use g_clear_* on finalize
Trivial cleanup, no functional changes.
gtk/gtkfilesystemmodel.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 20b670e774..d22acb5dcb 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -997,10 +997,8 @@ gtk_file_system_model_finalize (GObject *object)
int v;
FileModelNode *node = get_node (model, i);
- if (node->file)
- g_object_unref (node->file);
- if (node->info)
- g_object_unref (node->info);
+ g_clear_object (&node->file);
+ g_clear_object (&node->info);
for (v = 0; v < model->n_columns; v++)
if (G_VALUE_TYPE (&node->values[v]) != G_TYPE_INVALID)
@@ -1008,15 +1006,12 @@ gtk_file_system_model_finalize (GObject *object)
}
g_array_free (model->files, TRUE);
- g_object_unref (model->cancellable);
- g_free (model->attributes);
- if (model->dir)
- g_object_unref (model->dir);
- if (model->dir_monitor)
- g_object_unref (model->dir_monitor);
- g_hash_table_destroy (model->file_lookup);
- if (model->filter)
- g_object_unref (model->filter);
+ g_clear_object (&model->cancellable);
+ g_clear_pointer (&model->attributes, g_free);
+ g_clear_object (&model->dir);
+ g_clear_object (&model->dir_monitor);
+ g_clear_pointer (&model->file_lookup, g_hash_table_destroy);
+ g_clear_object (&model->filter);
g_slice_free1 (sizeof (GType) * model->n_columns, model->column_types);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]