NS_INIT_REFCNT must be called before any return else we crash. Fix for bug 14163

This commit is contained in:
ducarroz%netscape.com 1999-09-17 20:47:26 +00:00
parent 4e9ad19a5e
commit 8221260b78

View File

@ -55,6 +55,8 @@ static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
nsMsgCompose::nsMsgCompose()
{
NS_INIT_REFCNT();
mTempComposeFileSpec = nsnull;
mQuotingToFollow = PR_FALSE;
mSigFileSpec = nsnull;
@ -80,21 +82,19 @@ nsMsgCompose::nsMsgCompose()
PR_Free(default_mail_charset);
}
m_composeHTML = PR_FALSE;
// temporary - m_composeHTML from the "current" identity
// eventually we should know this when we open the compose window
// -alecf
nsresult rv;
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return;
nsCOMPtr<nsIMsgIdentity> identity;
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
if (NS_FAILED(rv)) return;
rv = identity->GetComposeHtml(&m_composeHTML);
NS_INIT_REFCNT();
m_composeHTML = PR_FALSE;
// temporary - m_composeHTML from the "current" identity
// eventually we should know this when we open the compose window
// -alecf
nsresult rv;
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgIdentity> identity;
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
if (NS_SUCCEEDED(rv))
rv = identity->GetComposeHtml(&m_composeHTML);
}
}