[gnome-software/cherry-pick-0e1695ce] flatpak: Refine new runtime's state to reflect current values




commit 9f7855997c82176f119a32e328422e97f680e47c
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 7 15:41:56 2021 +0000

    flatpak: Refine new runtime's state to reflect current values
    
    Newly created runtimes did not reflect current values, thus they could,
    for example, claim they are not installed, even when they had been installed.
    There are more such inaccuracies involved, not only the GsApp::state.
    This is especially important since the plugin's cache is freed on the flatpak
    repo change notifications.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1197
    
    
    (cherry picked from commit 0e1695ce07ba4c0df3ddb339d1333e44b7445fe7)

 plugins/flatpak/gs-flatpak.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 618706301..3dd1160b6 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2067,6 +2067,7 @@ gs_flatpak_create_runtime (GsFlatpak *self, GsApp *parent, const gchar *runtime)
        g_auto(GStrv) split = NULL;
        g_autoptr(GsApp) app_cache = NULL;
        g_autoptr(GsApp) app = NULL;
+       g_autoptr(GError) local_error = NULL;
 
        /* get the name/arch/branch */
        split = g_strsplit (runtime, "/", -1);
@@ -2105,6 +2106,9 @@ gs_flatpak_create_runtime (GsFlatpak *self, GsApp *parent, const gchar *runtime)
        gs_flatpak_app_set_ref_name (app, split[0]);
        gs_flatpak_app_set_ref_arch (app, split[1]);
 
+       if (!gs_flatpak_refine_app_state_unlocked (self, app, NULL, &local_error))
+               g_debug ("Failed to refine state for runtime '%s': %s", gs_app_get_unique_id (app), 
local_error->message);
+
        /* save in the cache */
        gs_plugin_cache_add (self->plugin, NULL, app);
        return g_steal_pointer (&app);


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