Bug 617945, crash in nsImapMailFolder::DeleteMessages, r=mkmelin
authorR Kent James <rkent@caspia.com>
Wed, 16 Mar 2016 10:00:34 -0700
changeset 24690 eb9570adfe513b7a064551235bb187cf3042cc21
parent 24689 4cdf4ffd43e0f85b27b7b8f3fa529b62424904dd
child 24691 bb1fbfbdb47f67169eea6d4c58cbda2d44eca22e
push id1657
push userclokep@gmail.com
push dateMon, 06 Jun 2016 19:50:21 +0000
treeherdercomm-beta@9fac989284b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs617945
Bug 617945, crash in nsImapMailFolder::DeleteMessages, r=mkmelin
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