[gtk] entry: Shorten finalize implementation
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] entry: Shorten finalize implementation
- Date: Tue, 20 Nov 2018 11:45:46 +0000 (UTC)
commit 08a07d4ae5fd6cded1216eb96943ca2115c60af6
Author: Timm Bäder <mail baedert org>
Date: Mon Nov 19 18:12:27 2018 +0100
entry: Shorten finalize implementation
By using g_clear_pointer and g_clear_object where appropriate.
gtk/gtkentry.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 682cce629c..f1e46116ea 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2763,32 +2763,24 @@ gtk_entry_finalize (GObject *object)
g_slice_free (EntryIconInfo, icon_info);
}
- if (priv->cached_layout)
- g_object_unref (priv->cached_layout);
-
- g_object_unref (priv->im_context);
+ g_clear_object (&priv->cached_layout);
+ g_clear_object (&priv->im_context);
+ g_clear_pointer (&priv->selection_bubble, gtk_widget_destroy);
+ g_clear_pointer (&priv->magnifier_popover, gtk_widget_destroy);
+ g_clear_pointer (&priv->progress_widget, gtk_widget_unparent);
+ g_clear_object (&priv->text_handle);
+ g_free (priv->placeholder_text);
+ g_free (priv->im_module);
if (priv->blink_timeout)
g_source_remove (priv->blink_timeout);
- if (priv->selection_bubble)
- gtk_widget_destroy (priv->selection_bubble);
-
- if (priv->magnifier_popover)
- gtk_widget_destroy (priv->magnifier_popover);
-
- if (priv->text_handle)
- g_object_unref (priv->text_handle);
- g_free (priv->placeholder_text);
- g_free (priv->im_module);
-
if (priv->tabs)
pango_tab_array_free (priv->tabs);
if (priv->attrs)
pango_attr_list_unref (priv->attrs);
- g_clear_pointer (&priv->progress_widget, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_entry_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]