[gnome-software] flatpak: Use the plugin cache to avoid creating duplicate GsApp objects



commit 618b7d2e2358d53d2c1a3515e98ece55292d0cd6
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 23 10:51:29 2016 +0100

    flatpak: Use the plugin cache to avoid creating duplicate GsApp objects

 src/plugins/gs-plugin-flatpak.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-flatpak.c b/src/plugins/gs-plugin-flatpak.c
index c13cf11..b067a04 100644
--- a/src/plugins/gs-plugin-flatpak.c
+++ b/src/plugins/gs-plugin-flatpak.c
@@ -400,7 +400,11 @@ gs_plugin_flatpak_create_installed (GsPlugin *plugin,
 
        /* create new object */
        id = gs_plugin_flatpak_build_id (priv->installation, FLATPAK_REF (xref));
-       app = gs_app_new (id);
+       app = gs_plugin_cache_lookup (plugin, id);
+       if (app == NULL) {
+               app = gs_app_new (id);
+               gs_plugin_cache_add (plugin, id, app);
+       }
        gs_plugin_flatpak_set_metadata_installed (app, xref);
 
        switch (flatpak_ref_get_kind (FLATPAK_REF(xref))) {


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