Bug 617945, crash in nsImapMailFolder::DeleteMessages, r=mkmelin a=rkent
authorR Kent James <rkent@caspia.com>
Wed, 16 Mar 2016 10:00:34 -0700
changeset 26814 c45514a56b282744d5c9e593945faa3b4fcf44dc
parent 26813 d6fcf3c1deb1621a08cf9e11bda9d585a8bcd45c
child 26815 d4bf9b03d79d927bfdb12858bde7493d47f8cc33
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