[geary] Fix a shutdown hang



commit 5cba0e4e77c3bd9803d5891fd5922ff2cc022570
Author: Michael Gratton <mike vee net>
Date:   Sun Mar 17 16:04:07 2019 +1100

    Fix a shutdown hang

 src/engine/imap-engine/imap-engine-generic-account.vala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 56e6477c..cb7f54af 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -181,16 +181,18 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
             );
         }
 
-        // Block obtaining and reusing IMAP connections
-        this.remote_ready_lock.reset();
-        this.imap.discard_returned_sessions = true;
-
         // Halt internal tasks early so they stop using local and
         // remote connections.
         this.refresh_folder_timer.reset();
         this.open_cancellable.cancel();
         this.processor.stop();
 
+        // Block obtaining and reusing IMAP connections. This *must*
+        // happen after internal tasks above are cancelled otherwise
+        // they may block while waiting/using a remote session.
+        this.imap.discard_returned_sessions = true;
+        this.remote_ready_lock.reset();
+
         // Close folders and ensure they do in fact close
 
         Gee.BidirSortedSet<Folder> locals = sort_by_path(this.local_only.values);


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