[geary/wip/rework-password-prompting: 4/5] Fix a deadlock when notifying engine of updated credentials



commit cd10cd7c077d709372ef1b7997c19444c62b3b33
Author: Michael Gratton <mike vee net>
Date:   Wed Mar 6 23:53:50 2019 +1100

    Fix a deadlock when notifying engine of updated credentials
    
    Don't restart a service when in the middle of propting for creds for it,
    since if there's another auth error while restarting, the client won't
    prompt again, and the service never resumes. Instead, restart at the end
    when finished prompting.

 src/client/application/geary-controller.vala | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 113eb245..b1a30021 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -793,12 +793,6 @@ public class GearyController : Geary.BaseObject {
                     yield libsecret.update_token(
                         account, creds_service, context.cancellable
                     );
-                    // Update the engine using the original service
-                    // however, since that is the one waiting for the
-                    // credentials
-                    yield this.application.engine.update_account_service(
-                        account, service, context.cancellable
-                    );
                 } catch (GLib.IOError.CANCELLED err) {
                     // all good
                 } catch (GLib.Error err) {
@@ -819,7 +813,11 @@ public class GearyController : Geary.BaseObject {
             context.authentication_prompting = false;
         }
 
-        if (!handled) {
+        if (handled) {
+            yield this.application.engine.update_account_service(
+                account, service, context.cancellable
+            );
+        } else {
             context.authentication_attempts = 0;
             context.authentication_failed = true;
             update_account_status();


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