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



commit 39c0063ec0c472ab33595a9a65fcd53fb2061e38
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 3003ad91..55afa8bb 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3056,6 +3056,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]