[gtk] filechooserwidget: Shorten finalize implementation a bit
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] filechooserwidget: Shorten finalize implementation a bit
- Date: Tue, 30 Apr 2019 04:02:38 +0000 (UTC)
commit 31fb5cc2d4229f308fad427cf951404f6318bc79
Author: Timm Bäder <tbaeder redhat com>
Date: Mon Apr 29 11:17:38 2019 +0200
filechooserwidget: Shorten finalize implementation a bit
gtk/gtkfilechooserwidget.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 3039007859..42e3782c54 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -671,8 +671,7 @@ gtk_file_chooser_widget_finalize (GObject *object)
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
GtkFileChooserWidgetPrivate *priv = impl->priv;
- if (priv->choices)
- g_hash_table_unref (priv->choices);
+ g_clear_pointer (&priv->choices, g_hash_table_unref);
if (priv->location_changed_id > 0)
g_source_remove (priv->location_changed_id);
@@ -682,21 +681,10 @@ gtk_file_chooser_widget_finalize (GObject *object)
g_free (priv->browse_files_last_selected_name);
g_slist_free_full (priv->filters, g_object_unref);
-
- if (priv->current_filter)
- g_object_unref (priv->current_filter);
-
- if (priv->current_volume_file)
- g_object_unref (priv->current_volume_file);
-
- if (priv->current_folder)
- g_object_unref (priv->current_folder);
-
- if (priv->preview_file)
- g_object_unref (priv->preview_file);
-
- if (priv->browse_path_bar_size_group)
- g_object_unref (priv->browse_path_bar_size_group);
+ g_clear_object (&priv->current_filter);
+ g_clear_object (&priv->current_volume_file);
+ g_clear_object (&priv->current_folder);
+ g_clear_object (&priv->browse_path_bar_size_group);
/* Free all the Models we have */
stop_loading_and_clear_list_model (impl, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]