[gnome-software] Use g_set_object() to fix a critical warning in gs_app_set_pixbuf()



commit 0f16acf255a18582b4c0d8925021a79f918f4d57
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 29 14:44:58 2015 +0100

    Use g_set_object() to fix a critical warning in gs_app_set_pixbuf()

 src/gs-app.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 1fb2f84..ac48df5 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -939,11 +939,7 @@ void
 gs_app_set_icon (GsApp *app, AsIcon *icon)
 {
        g_return_if_fail (GS_IS_APP (app));
-
-       /* save icon */
-       g_clear_object (&app->icon);
-       if (icon != NULL)
-               app->icon = g_object_ref (icon);
+       g_set_object (&app->icon, icon);
 }
 
 /**
@@ -1007,10 +1003,7 @@ void
 gs_app_set_pixbuf (GsApp *app, GdkPixbuf *pixbuf)
 {
        g_return_if_fail (GS_IS_APP (app));
-       g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-       if (app->pixbuf != NULL)
-               g_object_unref (app->pixbuf);
-       app->pixbuf = g_object_ref (pixbuf);
+       g_set_object (&app->pixbuf, pixbuf);
 }
 
 /**


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