Bug 797710, keep record of completed release in nsMsgFilterAfterTheFact, r=neil, a=rkent

This commit is contained in:
R Kent James 2015-09-07 18:23:26 -07:00
Родитель 413d06e888
Коммит 8543441cc2
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -319,6 +319,7 @@ protected:
nsCOMPtr<nsIMsgOperationListener> m_callback;
uint32_t m_nextAction; // next filter action to perform
nsresult mFinalResult; // report of overall success or failure
bool mNeedsRelease; // Did we need to release ourself?
};
NS_IMPL_ISUPPORTS(nsMsgFilterAfterTheFact, nsIUrlListener, nsIMsgSearchNotify, nsIMsgCopyServiceListener)
@ -336,6 +337,7 @@ nsMsgFilterAfterTheFact::nsMsgFilterAfterTheFact(nsIMsgWindow *aMsgWindow,
m_folders->GetLength(&m_numFolders);
NS_ADDREF(this); // we own ourselves, and will release ourselves when execution is done.
mNeedsRelease = true;
m_searchHitHdrs = do_CreateInstance(NS_ARRAY_CONTRACTID);
m_callback = aCallback;
@ -359,7 +361,12 @@ nsresult nsMsgFilterAfterTheFact::OnEndExecution()
(void)m_callback->OnStopOperation(mFinalResult);
nsresult rv = mFinalResult;
Release(); // release ourselves.
MOZ_ASSERT(mNeedsRelease, "OnEndExecution called a second time");
if (mNeedsRelease)
{
Release(); // release ourselves.
mNeedsRelease = false;
}
return rv;
}