[gnome-software] plugin loader: Improve error handling for app install / removal



commit bd87003225e6db4487bc00459ca651cc50e5a44a
Author: Kalev Lember <kalevlember gmail com>
Date:   Wed Jun 4 23:00:11 2014 +0200

    plugin loader: Improve error handling for app install / removal
    
    When app install / removal fails, properly clean up the pending apps
    queue on the error path as well. This can happen e.g. after canceling
    the polkit authorization dialog.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727309
    https://bugzilla.gnome.org/show_bug.cgi?id=731064

 src/gs-plugin-loader.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 4451228..fbe02f7 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -1905,10 +1905,13 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
                                           state->function_name,
                                           cancellable,
                                           &error);
-       if (!ret) {
+       if (ret) {
+               if (state->state_success != GS_APP_STATE_UNKNOWN)
+                       gs_app_set_state (state->app, state->state_success);
+               g_task_return_boolean (task, TRUE);
+       } else {
                gs_app_set_state (state->app, state->state_failure);
                g_task_return_error (task, error);
-               return;
        }
 
        /* remove from list */
@@ -1917,11 +1920,6 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
        g_mutex_unlock (&plugin_loader->priv->pending_apps_mutex);
        id = g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader));
        g_source_set_name_by_id (id, "[gnome-software] emit_pending_apps_idle");
-
-       /* success */
-       if (state->state_success != GS_APP_STATE_UNKNOWN)
-               gs_app_set_state (state->app, state->state_success);
-       g_task_return_boolean (task, TRUE);
 }
 
 static gboolean


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