Bug 617945, crash in nsImapMailFolder::DeleteMessages, r=mkmelin a=rkent THUNDERBIRD450b3_2016032415_RELBRANCH
authorR Kent James <rkent@caspia.com>
Wed, 16 Mar 2016 10:00:34 -0700
branchTHUNDERBIRD450b3_2016032415_RELBRANCH
changeset 26864 50211e00d3444006408a37cc04a32816908ac416
parent 26863 33dd6d58745f9f08fa81248b2f1095130a36d56a
child 26865 f1704ca9b780aeeacfb79935fafd0575499e1405
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, rkent
bugs617945
Bug 617945, crash in nsImapMailFolder::DeleteMessages, r=mkmelin a=rkent
mailnews/imap/src/nsImapMailFolder.cpp
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -2288,30 +2288,31 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMe
       messageFlags |= kImapMsgSeenFlag;
     rv = StoreImapFlags(messageFlags, deleteMsgs, srcKeyArray.Elements(),
                         srcKeyArray.Length(), urlListener);
 
     if (NS_SUCCEEDED(rv))
     {
       if (mDatabase)
       {
+        nsCOMPtr<nsIMsgDatabase> database(mDatabase);
         if (deleteModel == nsMsgImapDeleteModels::IMAPDelete)
-          MarkMessagesImapDeleted(&srcKeyArray, deleteMsgs, mDatabase);
+          MarkMessagesImapDeleted(&srcKeyArray, deleteMsgs, database);
         else
         {
           EnableNotifications(allMessageCountNotifications, false, true /*dbBatching*/);  //"remove it immediately" model
           // Notify if this is an actual delete.
           if (!isMove)
           {
             nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
             if (notifier)
               notifier->NotifyMsgsDeleted(messages);
           }
           DeleteStoreMessages(messages);
-          mDatabase->DeleteMessages(srcKeyArray.Length(), srcKeyArray.Elements(), nullptr);
+          database->DeleteMessages(srcKeyArray.Length(), srcKeyArray.Elements(), nullptr);
           EnableNotifications(allMessageCountNotifications, true, true /*dbBatching*/);
         }
         NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
       }
     }
     return rv;
   }
   else  // have to move the messages to the trash