[gnome-software/wip/mcrha/appstream-misc] gs-plugin-appstream: Change app state to installed only when not being updatable/updatable-live



commit 23a871581a03d7a87403bb7e2b7552a2587b4cff
Author: Milan Crha <mcrha redhat com>
Date:   Fri Sep 10 14:35:18 2021 +0200

    gs-plugin-appstream: Change app state to installed only when not being updatable/updatable-live
    
    This is to address occasional runtime warning about changing the app
    state from updatable to installed.

 plugins/core/gs-plugin-appstream.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index f7b3ae428..a9b280cb0 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -1035,7 +1035,10 @@ gs_plugin_add_installed (GsPlugin *plugin,
                g_autoptr(GsApp) app = gs_appstream_create_app (plugin, priv->silo, component, error);
                if (app == NULL)
                        return FALSE;
-               gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+               /* Can get cached gsApp, which has the state already updated */
+               if (gs_app_get_state (app) != GS_APP_STATE_UPDATABLE &&
+                   gs_app_get_state (app) != GS_APP_STATE_UPDATABLE_LIVE)
+                       gs_app_set_state (app, GS_APP_STATE_INSTALLED);
                gs_app_set_scope (app, AS_COMPONENT_SCOPE_SYSTEM);
                gs_app_list_add (list, app);
        }


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