[geary/wip/cx-reestablish] Added some safety handling to internal_close_async()



commit f541a7027ddcd32b961523ec57305b2c66d20b82
Author: Jim Nelson <jim yorba org>
Date:   Tue Jan 13 19:08:27 2015 -0800

    Added some safety handling to internal_close_async()

 .../imap-engine/imap-engine-minimal-folder.vala    |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala 
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 2407a5f..b284114 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -786,8 +786,10 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
         remote_opened = false;
         
         // use background call to (a) close remote if necessary and/or (b) reestablish connection if
-        // necessary
-        if (closing_remote_folder != null || open_count > 0) {
+        // necessary ... store reestablish condition now, before scheduling close_remote_folder_async(),
+        // as it touches open_count
+        bool reestablish = open_count > 0;
+        if (closing_remote_folder != null || reestablish) {
             // to avoid keeping the caller waiting while the remote end closes (i.e. drops the
             // connection or performs an IMAP CLOSE operation), close it in the background and
             // reestablish connection there, if necessary
@@ -804,7 +806,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
         }
         
         // if reestablishing in close_remote_folder_async(), go no further
-        if (open_count > 0)
+        if (reestablish)
             return;
         
         // forced closed one way or another, so reset state


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