[gtk+] Trivial: Use g_clear_object more



commit 327b097725d133369d42313d0172a3b1f0f7d2d0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 9 10:13:55 2014 +0200

    Trivial: Use g_clear_object more
    
    It no longer has atomic overhead, so we can use it everywhere.

 gtk/gtkcontainer.c |    6 +-----
 gtk/gtkwidget.c    |    3 +--
 2 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 1c8e78e..05c1bc0 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1398,11 +1398,7 @@ gtk_container_destroy (GtkWidget *widget)
   if (priv->restyle_pending)
     priv->restyle_pending = FALSE;
 
-  if (priv->focus_child)
-    {
-      g_object_unref (priv->focus_child);
-      priv->focus_child = NULL;
-    }
+  g_clear_object (&priv->focus_child);
 
   /* do this before walking child widgets, to avoid
    * removing children from focus chain one by one.
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c0407a9..1fa2958 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12140,8 +12140,7 @@ gtk_widget_finalize (GObject *object)
 
   gtk_grab_remove (widget);
 
-  g_object_unref (priv->style);
-  priv->style = NULL;
+  g_clear_object (&priv->style);
 
   g_free (priv->name);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]