[gnome-software: 27/29] gs-flatpak: Ensure installed GsApps are marked as such at creation time




commit 6b3ceb2081d1d7920a3b42e0246fc255971ed482
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Dec 3 13:59:46 2021 +0000

    gs-flatpak: Ensure installed GsApps are marked as such at creation time
    
    It seems it’s possible for a `GsApp` to be in the cache when
    `create_installed()` is called, with a state of `AVAILABLE`. That
    prevents the app from being marked as `INSTALLED`, even though
    `create_installed()` is only called from places where we know the app is
    installed.
    
    This points to some kind of missing cache invalidation/update when an
    app goes from available → installed, but I have not managed to track it
    down.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/flatpak/gs-flatpak.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a8fafd8a9..403c212b1 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1356,8 +1356,10 @@ gs_flatpak_create_installed (GsFlatpak *self,
        /* create new object */
        origin = flatpak_installed_ref_get_origin (xref);
        app = gs_flatpak_create_app (self, origin, FLATPAK_REF (xref), xremote, cancellable);
-       if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN)
-               gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+
+       gs_app_set_state (app, GS_APP_STATE_UNKNOWN);
+       gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+
        gs_flatpak_set_metadata_installed (self, app, xref, cancellable);
        return g_steal_pointer (&app);
 }


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