Bug 725810 Fix miscalculation of expunged bytes r=bienvenu,a=bienvenu SEAMONKEY_2_10b2_BUILD1 SEAMONKEY_2_10b2_RELEASE
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 20 May 2012 20:50:24 +0100
changeset 11330 5a0df11fc4a96612d0457fd241f8da5268591ea3
parent 11329 cd00c74eef127055aea156f8234dcc19e427f69b
child 11331 7599f71809082d183160c9d4ded99e8e691fda5b
push id499
push userbienvenu@nventure.com
push dateMon, 21 May 2012 17:32:06 +0000
treeherdercomm-beta@5a0df11fc4a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu, bienvenu
bugs725810
Bug 725810 Fix miscalculation of expunged bytes r=bienvenu,a=bienvenu
mailnews/base/util/nsMsgDBFolder.cpp
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -1815,27 +1815,27 @@ nsresult nsMsgDBFolder::HandleAutoCompac
     nsCOMPtr<nsISupportsArray> allServers;
     rv = accountMgr->GetAllServers(getter_AddRefs(allServers));
     NS_ENSURE_SUCCESS(rv, rv);
     PRUint32 numServers = 0, serverIndex = 0;
     rv = allServers->Count(&numServers);
     PRInt32 offlineSupportLevel;
     if (numServers > 0)
     {
-      nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, serverIndex);
-      NS_ENSURE_SUCCESS(rv, rv);
       nsCOMPtr<nsIMutableArray> folderArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       nsCOMPtr<nsIMutableArray> offlineFolderArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       PRInt32 totalExpungedBytes = 0;
       PRInt32 offlineExpungedBytes = 0;
       PRInt32 localExpungedBytes = 0;
       do
       {
+        nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, serverIndex);
+        NS_ENSURE_SUCCESS(rv, rv);
         nsCOMPtr<nsIMsgPluggableStore> msgStore;
         rv = server->GetMsgStore(getter_AddRefs(msgStore));
         NS_ENSURE_SUCCESS(rv, rv);
         if (!msgStore)
           continue;
         bool supportsCompaction;
         msgStore->GetSupportsCompaction(&supportsCompaction);
         if (!supportsCompaction)
@@ -1870,26 +1870,26 @@ nsresult nsMsgDBFolder::HandleAutoCompac
               }
             }
           }
           else  //pop or local
           {
             for (PRUint32 i = 0; i < cnt; i++)
             {
               nsCOMPtr<nsIMsgFolder> folder = do_QueryElementAt(allDescendents, i);
+              expungedBytes = 0;
               folder->GetExpungedBytes(&expungedBytes);
               if (expungedBytes > 0 )
               {
                 folderArray->AppendElement(folder, false);
                 localExpungedBytes += expungedBytes;
               }
             }
           }
         }
-        server = do_QueryElementAt(allServers, serverIndex);
       }
       while (++serverIndex < numServers);
       totalExpungedBytes = localExpungedBytes + offlineExpungedBytes;
       PRInt32 purgeThreshold;
       rv = GetPurgeThreshold(&purgeThreshold);
       NS_ENSURE_SUCCESS(rv, rv);
       if (totalExpungedBytes > (purgeThreshold * 1024))
       {