for mscott fix memory leaks of imap urls 15088 r=bienvenu, a=chofmann

This commit is contained in:
bienvenu%netscape.com 1999-09-28 21:50:04 +00:00
Родитель e2628d57d0
Коммит bdbeecff29
5 изменённых файлов: 25 добавлений и 6 удалений

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

@ -54,4 +54,5 @@ interface nsIImapMockChannel : nsIChannel
void GetChannelContext(out nsISupports aChannelContext);
void SetLoadGroup(in nsILoadGroup aLoadGroup);
void SetURI(in nsIURI aUrl);
void Close();
};

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

@ -165,6 +165,7 @@ NS_IMETHODIMP nsImapMailFolder::GetPath(nsIFileSpec** aPathName)
return NS_ERROR_OUT_OF_MEMORY;
rv = nsImapURI2Path(kImapRootURI, mURI, *m_pathName);
// printf("constructing path %s\n", (const char *) *m_pathName);
if (NS_FAILED(rv)) return rv;
}
rv = NS_NewFileSpecWithSpec(*m_pathName, aPathName);
@ -715,7 +716,7 @@ NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force)
{
// could we move this into nsMsgDBFolder, or do we need to deal
// with the pending imap counts?
nsresult rv;
nsresult rv = NS_OK;
PRInt32 oldUnreadMessages = mNumUnreadMessages;
PRInt32 oldTotalMessages = mNumTotalMessages;
@ -745,7 +746,6 @@ NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force)
PR_smprintf_free(oldUnreadMessagesStr);
}
return NS_OK;
return rv;
}

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

@ -605,7 +605,11 @@ void nsImapProtocol::ReleaseUrlState()
m_imapMiscellaneousSink = null_nsCOMPtr();
m_channelListener = null_nsCOMPtr();
m_channelContext = null_nsCOMPtr();
m_mockChannel = null_nsCOMPtr();
if (m_mockChannel)
{
m_mockChannel->Close();
m_mockChannel = null_nsCOMPtr();
}
m_channelInputStream = null_nsCOMPtr();
m_channelOutputStream = null_nsCOMPtr();
@ -666,7 +670,11 @@ NS_IMETHODIMP nsImapProtocol::Run()
me->m_outputStream = null_nsCOMPtr();
me->m_channelListener = null_nsCOMPtr();
me->m_channelContext = null_nsCOMPtr();
me->m_mockChannel = null_nsCOMPtr();
if (me->m_mockChannel)
{
me->m_mockChannel->Close();
me->m_mockChannel = null_nsCOMPtr();
}
me->m_channelInputStream = null_nsCOMPtr();
me->m_channelOutputStream = null_nsCOMPtr();
me->m_sinkEventQueue = null_nsCOMPtr();
@ -6143,12 +6151,19 @@ NS_IMPL_ISUPPORTS2(nsImapMockChannel, nsIImapMockChannel, nsIChannel)
nsImapMockChannel::nsImapMockChannel()
{
NS_INIT_REFCNT();
m_channelContext = nsnull;
}
nsImapMockChannel::~nsImapMockChannel()
{
}
NS_IMETHODIMP nsImapMockChannel::Close()
{
m_channelListener = null_nsCOMPtr();
return NS_OK;
}
nsresult nsImapMockChannel::Create(const nsIID &iid, void ** aInstancePtrResult)
{
/* note this new macro for assertions...they can take a string describing the assertion */

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

@ -554,7 +554,9 @@ protected:
nsIURI * m_url;
nsCOMPtr<nsILoadGroup> m_loadGroup;
nsCOMPtr<nsIStreamListener> m_channelListener;
nsCOMPtr<nsISupports> m_channelContext;
// non owning ref of the context in order to fix a circular ref count
// because the context is already the uri...
nsISupports * m_channelContext;
};
#endif // nsImapProtocol_h___

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

@ -152,7 +152,8 @@ nsImapURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult)
NS_MsgHashIfNecessary(parentName);
parentName += sbdSep;
pathResult += (const char *) parentName;
parentName = leafName;
// this fixes a strange purify warning.
parentName = (const char *) leafName;
dirEnd = parentName.FindChar('/');
}
if (!leafName.IsEmpty()) {