[gnome-photos/wip/rishi/base-item-g_auto] base-item: Use g_auto*




commit 634c8c342b82ffadc1b4d0cd835eeb28e329a89f
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Apr 7 22:59:37 2021 +0200

    base-item: Use g_auto*
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/77

 src/photos-base-item.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 6232804d..655742f6 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -386,7 +386,7 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
   PhotosBaseItemPrivate *priv;
   GApplication *app;
   GIcon *pix;
-  GList *emblem_icons = NULL;
+  g_autolist (GIcon) emblem_icons = NULL;
   GList *windows;
   g_autoptr (GdkPixbuf) emblemed_pixbuf = NULL;
   GdkWindow *window = NULL;
@@ -440,18 +440,13 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
       if (icon_info != NULL)
         {
           g_autoptr (GError) error = NULL;
-          GdkPixbuf *tmp;
+          g_autoptr (GdkPixbuf) tmp = NULL;
 
           tmp = gtk_icon_info_load_icon (icon_info, &error);
           if (error != NULL)
-            {
-              g_warning ("Unable to render the emblem: %s", error->message);
-            }
+            g_warning ("Unable to render the emblem: %s", error->message);
           else
-            {
-              g_object_unref (emblemed_pixbuf);
-              emblemed_pixbuf = tmp;
-            }
+            g_set_object (&emblemed_pixbuf, tmp);
         }
     }
 
@@ -467,7 +462,7 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
   g_signal_emit (self, signals[INFO_UPDATED], 0);
 
  out:
-  g_list_free_full (emblem_icons, g_object_unref);
+  return;
 }
 
 


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