[gnome-software/1131-featured-carousel: 14/21] dummy: Fix a memory leak of some pixbufs




commit 029e791b46cce8622fffa915f59dc40b4eaa35c1
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Feb 17 19:57:25 2021 +0000

    dummy: Fix a memory leak of some pixbufs
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/dummy/gs-plugin-dummy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/dummy/gs-plugin-dummy.c b/plugins/dummy/gs-plugin-dummy.c
index bb407a4dd..a6f834f42 100644
--- a/plugins/dummy/gs-plugin-dummy.c
+++ b/plugins/dummy/gs-plugin-dummy.c
@@ -737,13 +737,14 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
                             GCancellable *cancellable,
                             GError **error)
 {
+       g_autoptr(GdkPixbuf) pixbuf = gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL);
        g_autoptr(GsApp) app = gs_app_new ("chiron.desktop");
        gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Chiron");
        gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, "http://www.box.org";);
        gs_app_set_kind (app, AS_COMPONENT_KIND_DESKTOP_APP);
        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
-       gs_app_add_pixbuf (app, gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL));
+       gs_app_add_pixbuf (app, pixbuf);
        gs_app_set_kind (app, AS_COMPONENT_KIND_DESKTOP_APP);
        gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
        gs_app_list_add (list, app);
@@ -757,13 +758,14 @@ gs_plugin_add_recent (GsPlugin *plugin,
                      GCancellable *cancellable,
                      GError **error)
 {
+       g_autoptr(GdkPixbuf) pixbuf = gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL);
        g_autoptr(GsApp) app = gs_app_new ("chiron.desktop");
        gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Chiron");
        gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, "http://www.box.org";);
        gs_app_set_kind (app, AS_COMPONENT_KIND_DESKTOP_APP);
        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
-       gs_app_add_pixbuf (app, gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL));
+       gs_app_add_pixbuf (app, pixbuf);
        gs_app_set_kind (app, AS_COMPONENT_KIND_DESKTOP_APP);
        gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
        gs_app_list_add (list, app);


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