# HG changeset patch # User Jorg K # Date 1521542912 -3600 # Node ID 5074b2ccb931aee4ba766f7cb724bc91a1b30fce # Parent 122a7dc8995b2b460ae37660eab6dcf4286d0f0d Bug 556355 - Make sure the nsIMsgSend doesn't go away before we're done. r=m_kato a=jorgk diff --git a/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mailnews/compose/src/nsMsgAttachmentHandler.cpp --- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -1363,20 +1363,11 @@ nsMsgAttachmentHandler::GetMimeDeliveryS *_retval = m_mime_delivery_state; NS_IF_ADDREF(*_retval); return NS_OK; } nsresult nsMsgAttachmentHandler::SetMimeDeliveryState(nsIMsgSend* mime_delivery_state) { - /* - Because setting m_mime_delivery_state to null could destroy ourself as - m_mime_delivery_state it's our parent, we need to protect ourself against - that! - - This extra comptr is necessary, - see bug http://bugzilla.mozilla.org/show_bug.cgi?id=78967 - */ - nsCOMPtr temp = m_mime_delivery_state; /* Should lock our parent until the end of the function */ m_mime_delivery_state = mime_delivery_state; return NS_OK; } diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp --- a/mailnews/compose/src/nsMsgSend.cpp +++ b/mailnews/compose/src/nsMsgSend.cpp @@ -424,16 +424,18 @@ void nsMsgComposeAndSend::GenerateMessag /* All of the desired attachments have been written to individual temp files, and we know what's in them. Now we need to make a final temp file of the actual mail message, containing all of the other files after having been encoded as appropriate. */ NS_IMETHODIMP nsMsgComposeAndSend::GatherMimeAttachments() { + nsCOMPtr kungFuDeathGrip(this); + bool shouldDeleteDeliveryState = true; nsresult status; uint32_t i; PRFileDesc *in_file = 0; char *buffer = 0; nsString msg; bool body_is_us_ascii = true; bool isUsingQP = false;