[gnome-software/gnome-3-22] Recover the state of the app when failing to install the flatpak runtime



commit ac6166a3f600b35760c358d76bd5aa8a22e74475
Author: Richard Hughes <richard hughsie com>
Date:   Wed Sep 21 19:35:53 2016 +0100

    Recover the state of the app when failing to install the flatpak runtime
    
    (cherry picked from commit b5c3c7c839b375473396fa9c904d3b020415bb4e)

 src/plugins/gs-flatpak.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index dfa1d32..c30d362 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1741,21 +1741,25 @@ gs_flatpak_app_install (GsFlatpak *self,
                runtime = gs_app_get_runtime (app);
 
                /* the runtime could come from a different remote to the app */
-               if (!gs_refine_item_metadata (self, runtime, cancellable,
-                                             error))
+               if (!gs_refine_item_metadata (self, runtime, cancellable, error)) {
+                       gs_app_set_state_recover (app);
                        return FALSE;
-               if (!gs_plugin_refine_item_origin (self,
-                                                  runtime, cancellable, error))
+               }
+               if (!gs_plugin_refine_item_origin (self, runtime, cancellable, error)) {
+                       gs_app_set_state_recover (app);
                        return FALSE;
-               if (!gs_plugin_refine_item_state (self, runtime,
-                                                 cancellable, error))
+               }
+               if (!gs_plugin_refine_item_state (self, runtime, cancellable, error)) {
+                       gs_app_set_state_recover (app);
                        return FALSE;
+               }
                if (gs_app_get_state (runtime) == AS_APP_STATE_UNKNOWN) {
                        g_set_error (error,
                                     GS_PLUGIN_ERROR,
                                     GS_PLUGIN_ERROR_NOT_SUPPORTED,
                                     "Failed to find runtime %s",
                                     gs_app_get_source_default (runtime));
+                       gs_app_set_state_recover (app);
                        return FALSE;
                }
 
@@ -1774,6 +1778,7 @@ gs_flatpak_app_install (GsFlatpak *self,
                                                             cancellable, error);
                        if (xref == NULL) {
                                gs_app_set_state_recover (runtime);
+                               gs_app_set_state_recover (app);
                                return FALSE;
                        }
                        gs_app_set_state (runtime, AS_APP_STATE_INSTALLED);


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