[gnome-software] plugin loader: When installing updates, skip over already installed apps



commit 112a2f7ffa017625a66c35fc42a52bf02940b631
Author: Kalev Lember <klember redhat com>
Date:   Thu Oct 11 11:59:46 2018 +0200

    plugin loader: When installing updates, skip over already installed apps
    
    When we are updating multiple apps together, it can happen that an app
    gets updated before we call gs_plugin_update_app() on it. E.g. we are
    updating a flatpak app and a runtime: first in the list is the app,
    which we call update_app on, but then the app update installs the
    runtime first, and when the plugin loader gets to the runtime in the
    list, it will have already been installed at that point, leading to
    state change warnings (installed->installing) when the plugin tries to
    process it.
    
    This commit fixes this by just skipping over anything that's already in
    the installed state.

 lib/gs-plugin-loader.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index f5944cee..46493240 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -2994,6 +2994,10 @@ gs_plugin_loader_generic_update (GsPluginLoader *plugin_loader,
                        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                                return FALSE;
 
+                       /* already installed? */
+                       if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED)
+                               continue;
+
                        /* make sure that the app update is cancelled when the whole op is cancelled */
                        app_cancellable = gs_app_get_cancellable (app);
                        cancel_handler_id = g_cancellable_connect (cancellable,


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