Bug 1334874 - Backed out changeset 6483fa45f5b2 for causing Mozmill crash. a=jorgk
authorJorg K
Tue, 07 Feb 2017 14:31:49 +0100
changeset 21112 d28d4429f6faa8bc5a1e48278e530efa05b1d086
parent 21111 6ba5dceb464c7853076ad781e10b34c61539bcce
child 21113 ca2a414d8738bbfb6b6fe56092437e77a552dbe4
push id12824
push usermozilla@jorgk.com
push dateTue, 07 Feb 2017 13:34:16 +0000
treeherdercomm-central@d28d4429f6fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1334874
Bug 1334874 - Backed out changeset 6483fa45f5b2 for causing Mozmill crash. a=jorgk
mailnews/compose/src/nsMsgComposeService.cpp
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -761,16 +761,18 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::
   nsCOMPtr<nsIMsgCompose> pMsgCompose (do_CreateInstance(NS_MSGCOMPOSE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   /** initialize nsIMsgCompose, Send the message, wait for send completion response **/
 
   rv = pMsgCompose->Initialize(pMsgComposeParams, parentWindow, nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
 
+  Release();
+
   return pMsgCompose->SendMsg(nsIMsgSend::nsMsgDeliverNow, mIdentity, nullptr, nullptr, nullptr) ;
 }
 
 NS_IMETHODIMP
 nsMsgTemplateReplyHelper::OnStartRequest(nsIRequest* request, nsISupports* aSupport)
 {
   return NS_OK;
 }
@@ -897,17 +899,21 @@ NS_IMETHODIMP nsMsgComposeService::Reply
     {
       identity = anIdentity;
       break;
     }
   }
   if (!identity) // Found no match -> don't reply.
     return NS_ERROR_ABORT;
 
-  RefPtr<nsMsgTemplateReplyHelper> helper = new nsMsgTemplateReplyHelper;
+  nsMsgTemplateReplyHelper *helper = new nsMsgTemplateReplyHelper;
+  if (!helper)
+    return NS_ERROR_OUT_OF_MEMORY;
+
+  NS_ADDREF(helper);
 
   helper->mHdrToReplyTo = aMsgHdr;
   helper->mMsgWindow = aMsgWindow;
   helper->mIdentity = identity;
 
   nsAutoCString replyTo;
   aMsgHdr->GetStringProperty("replyTo", getter_Copies(replyTo));
   if (replyTo.IsEmpty())