Bug 1364167 - Do not change folders when repairing a folder other than the current one. r+a=jorgk THUNDERBIRD_71_0b4_BUILD1 THUNDERBIRD_71_0b4_RELEASE
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 12 Nov 2019 21:20:04 +1300
changeset 37304 20970f9897f9f80578e1135c7578ca84ee40b97c
parent 37303 cc97a8435bb674f47022d1b61e70ac0e54730b32
child 37305 b05032b5ab031830afe49568f53ddc928701b1bc
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
bugs1364167
Bug 1364167 - Do not change folders when repairing a folder other than the current one. r+a=jorgk
mail/base/content/folderPane.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2934,17 +2934,22 @@ var gFolderTreeController = {
         // Remove the offline store, if any.
         let offlineStore = folder.filePath;
         // XXX todo: figure out how to delete a maildir directory async. This
         // delete causes main thread lockup for large maildir folders.
         if (offlineStore.exists()) {
           offlineStore.remove(true);
         }
       }
-      gFolderDisplay.view.close();
+
+      // We may be rebuilding a folder that is not the displayed one.
+      let sameFolder = gFolderDisplay.displayedFolder == folder;
+      if (sameFolder) {
+        gFolderDisplay.view.close();
+      }
 
       // Send a notification that we are triggering a database rebuild.
       MailServices.mfn.notifyItemEvent(
         folder,
         "FolderReindexTriggered",
         null,
         null
       );
@@ -2955,17 +2960,19 @@ var gFolderTreeController = {
       msgDB.summaryValid = false;
       try {
         folder.closeAndBackupFolderDB("");
       } catch (e) {
         // In a failure, proceed anyway since we're dealing with problems
         folder.ForceDBClosed();
       }
       folder.updateFolder(msgWindow);
-      gFolderDisplay.show(folder);
+      if (sameFolder) {
+        gFolderDisplay.show(folder);
+      }
     }
 
     window.openDialog(
       "chrome://messenger/content/folderProps.xul",
       "",
       "chrome,modal,centerscreen",
       {
         folder,