[geary] Fix inifinite loop removing folders that have disappeared



commit 02692466cd5676e32f2f3faf5cae665b797aa6c9
Author: Michael Gratton <mike vee net>
Date:   Wed Feb 20 21:43:48 2019 +1100

    Fix inifinite loop removing folders that have disappeared
    
    Brown paper bag misuse of BidiIterator 🙄

 src/client/application/geary-controller.vala            | 3 +--
 src/engine/imap-engine/imap-engine-generic-account.vala | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index e76c5c20..499b5d99 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1442,9 +1442,8 @@ public class GearyController : Geary.BaseObject {
             Gee.BidirIterator<Geary.Folder> unavailable_iterator =
                 unavailable.bidir_iterator();
             unavailable_iterator.last();
-            while (unavailable_iterator.valid) {
+            while (unavailable_iterator.previous()) {
                 Geary.Folder folder = unavailable_iterator.get();
-                unavailable_iterator.previous();
 
                 main_window.folder_list.remove_folder(folder);
                 if (folder.account == current_account) {
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 83369212..165254d0 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -1323,9 +1323,8 @@ internal class Geary.ImapEngine.UpdateRemoteFolders : AccountOperation {
             Gee.BidirIterator<MinimalFolder> removed_iterator =
                 removed.bidir_iterator();
             removed_iterator.last();
-            while (removed_iterator.valid) {
+            while (removed_iterator.previous()) {
                 MinimalFolder folder = removed_iterator.get();
-                removed_iterator.previous();
 
                 try {
                     debug("Locally deleting removed folder %s", folder.to_string());


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