Bug 1242925 - use local database variable to prevent crash in msMsgLocalMailFolder::DeleteMessages, r=neil, a=rkent THUNDERBIRD452b1_2016051723_RELBRANCH
authorR Kent James <rkent@caspia.com>
Wed, 17 Feb 2016 11:10:40 -0800
branchTHUNDERBIRD452b1_2016051723_RELBRANCH
changeset 24540 bf436666bca1acfb2054e21db32f1eb965de1dcc
parent 24539 d9529e352d7976f43ad167d7e12c9f37b57183f9
child 24541 6fef5bf716007a217e32cc9a5ce65acdac99fc4a
push id1641
push userkent@caspia.com
push dateWed, 18 May 2016 07:34:32 +0000
treeherdercomm-beta@3d73a3597a7e [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
@@ -1214,25 +1214,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