[gtk+/gtk-3-20] GtkLabel: Use g_clear_object
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] GtkLabel: Use g_clear_object
- Date: Thu, 5 May 2016 19:21:03 +0000 (UTC)
commit 021d065a1f62826d9c124dc71b22e48f781719d8
Author: Timm Bäder <mail baedert org>
Date: Sun Apr 24 10:46:03 2016 +0200
GtkLabel: Use g_clear_object
https://bugzilla.gnome.org/show_bug.cgi?id=765496
gtk/gtklabel.c | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index caf031c..6464157 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3288,14 +3288,9 @@ gtk_label_finalize (GObject *object)
g_free (priv->label);
g_free (priv->text);
- if (priv->layout)
- g_object_unref (priv->layout);
-
- if (priv->attrs)
- pango_attr_list_unref (priv->attrs);
-
- if (priv->markup_attrs)
- pango_attr_list_unref (priv->markup_attrs);
+ g_clear_object (&priv->layout);
+ g_clear_pointer (&priv->attrs, pango_attr_list_unref);
+ g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
if (priv->select_info)
{
@@ -3314,13 +3309,7 @@ gtk_label_finalize (GObject *object)
static void
gtk_label_clear_layout (GtkLabel *label)
{
- GtkLabelPrivate *priv = label->priv;
-
- if (priv->layout)
- {
- g_object_unref (priv->layout);
- priv->layout = NULL;
- }
+ g_clear_object (&label->priv->layout);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]