[gtk+/gtk-3-10] iconhelper: Use g_clear_* helpers



commit 5b5a4b5dfc0924c9c6dbbd0712de3aef76b5b4e8
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 2 15:06:36 2013 +0200

    iconhelper: Use g_clear_* helpers
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709264

 gtk/gtkiconhelper.c |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 2200e3c..397ba2f 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -62,18 +62,8 @@ _gtk_icon_helper_clear (GtkIconHelper *self)
   g_clear_object (&self->priv->animation);
   g_clear_object (&self->priv->rendered_pixbuf);
   g_clear_object (&self->priv->window);
-
-  if (self->priv->orig_surface)
-    {
-      cairo_surface_destroy (self->priv->orig_surface);
-      self->priv->orig_surface = NULL;
-    }
-
-  if (self->priv->rendered_surface)
-    {
-      cairo_surface_destroy (self->priv->rendered_surface);
-      self->priv->rendered_surface = NULL;
-    }
+  g_clear_pointer (&self->priv->orig_surface, cairo_surface_destroy);
+  g_clear_pointer (&self->priv->rendered_surface, cairo_surface_destroy);
 
   if (self->priv->icon_set != NULL)
     {
@@ -83,11 +73,8 @@ _gtk_icon_helper_clear (GtkIconHelper *self)
       self->priv->icon_set = NULL;
     }
 
-  g_free (self->priv->icon_name);
-  self->priv->icon_name = NULL;
-
-  g_free (self->priv->stock_id);
-  self->priv->stock_id = NULL;
+  g_clear_pointer (&self->priv->icon_name, g_free);
+  g_clear_pointer (&self->priv->stock_id, g_free);
 
   self->priv->storage_type = GTK_IMAGE_EMPTY;
   self->priv->icon_size = GTK_ICON_SIZE_INVALID;


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