some fixes for news memory leaks r=mscott 51359

This commit is contained in:
bienvenu%netscape.com 2000-09-07 14:13:23 +00:00
Родитель 21001a9e67
Коммит f0370e6b85
3 изменённых файлов: 21 добавлений и 2 удалений

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

@ -104,6 +104,7 @@ nsresult nsMsgMailNewsUrl::SetUrlState(PRBool aRunningUrl, nsresult aExitCode)
else
{
m_urlListeners->OnStopRunningUrl(this, aExitCode);
m_loadGroup = nsnull; // try to break circular refs.
}
}
else

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

@ -584,6 +584,7 @@ NS_IMETHODIMP nsNNTPProtocol::Initialize(nsIURI * aURL, nsIMsgWindow *aMsgWindow
m_dataBuf = (char *) PR_Malloc(sizeof(char) * OUTPUT_BUFFER_SIZE);
m_dataBufSize = OUTPUT_BUFFER_SIZE;
if (!m_lineStreamBuffer)
m_lineStreamBuffer = new nsMsgLineStreamBuffer(OUTPUT_BUFFER_SIZE, CRLF, PR_TRUE /* create new lines */);
m_nextState = SEND_FIRST_NNTP_COMMAND;
@ -5034,6 +5035,9 @@ nsresult nsNNTPProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inp
NS_IMETHODIMP nsNNTPProtocol::CloseConnection()
{
SendData(nsnull, NNTP_CMD_QUIT); // this will cause OnStopRequest get called, which will call CloseSocket()
// break some cycles
m_newsHost = nsnull;
m_nntpServer = nsnull;
return NS_OK;
}
@ -5081,7 +5085,18 @@ nsresult nsNNTPProtocol::CleanupAfterRunningUrl()
PR_FREEIF(m_cancelID);
m_cancelID = nsnull;
mDisplayInputStream = nsnull;
mDisplayOutputStream = nsnull;
m_channelListener = nsnull;
m_channelContext = nsnull;
m_loadGroup = nsnull;
mProgressEventSink = nsnull;
SetOwner(nsnull);
m_runningURL = null_nsCOMPtr();
m_url = null_nsCOMPtr();
m_originalUrl = null_nsCOMPtr();
m_connectionBusy = PR_FALSE;
return NS_OK;
}

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

@ -409,10 +409,13 @@ nsNntpIncomingServer::CloseCachedConnections()
if (NS_FAILED(rv)) return rv;
for (PRUint32 i = 0; i < cnt; i++)
{
aSupport = getter_AddRefs(m_connectionCache->ElementAt(i));
aSupport = getter_AddRefs(m_connectionCache->ElementAt(0));
connection = do_QueryInterface(aSupport);
if (connection)
{
rv = connection->CloseConnection();
RemoveConnection(connection);
}
}
}
rv = WriteNewsrcFile();