Bug 1242925 - use local database variable to prevent crash in msMsgLocalMailFolder::DeleteMessages, r=neil a=rkent
authorR Kent James <rkent@caspia.com>
Wed, 17 Feb 2016 11:10:40 -0800
changeset 22241 84ca41c78166da24f19b8568fab45784fefd2d3d
parent 22240 e751759cf972d051186d4b9adc7bdb703549c2e7
child 22242 9024b08bdd48442eb0dcecd6ca5402c92b7982e0
push id91
push userkent@caspia.com
push dateWed, 09 Mar 2016 18:45:48 +0000
treeherdercomm-esr38@84ca41c78166 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, rkent
bugs1242925
Bug 1242925 - use local database variable to prevent crash in msMsgLocalMailFolder::DeleteMessages, r=neil a=rkent
mailnews/local/src/nsLocalMailFolder.cpp
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -1213,25 +1213,21 @@ nsMsgLocalMailFolder::DeleteMessages(nsI
       rv = EnableNotifications(allMessageCountNotifications, false, true /*dbBatching*/);
       if (NS_SUCCEEDED(rv))
       {
         nsCOMPtr<nsIMsgPluggableStore> msgStore;
         rv = GetMsgStore(getter_AddRefs(msgStore));
         if (NS_SUCCEEDED(rv))
         {
           rv = msgStore->DeleteMessages(messages);
-          GetDatabase();
           nsCOMPtr<nsIMsgDBHdr> msgDBHdr;
-          if (mDatabase)
+          for (uint32_t i = 0; i < messageCount; ++i)
           {
-            for (uint32_t i = 0; i < messageCount; ++i)
-            {
-              msgDBHdr = do_QueryElementAt(messages, i, &rv);
-              rv = mDatabase->DeleteHeader(msgDBHdr, nullptr, false, true);
-            }
+            msgDBHdr = do_QueryElementAt(messages, i, &rv);
+            rv = msgDB->DeleteHeader(msgDBHdr, nullptr, false, true);
           }
         }
       }
       else if (rv == NS_MSG_FOLDER_BUSY)
         ThrowAlertMsg("deletingMsgsFailed", msgWindow);
 
       // we are the source folder here for a move or shift delete
       //enable notifications because that will close the file stream