(r=valeski) Fix for new bloat (leaking HTTPChannels) that was introduced yesterday

This commit is contained in:
rpotts%netscape.com 1999-12-01 04:32:58 +00:00
parent 46665376d1
commit 1b0f903b3f
2 changed files with 9 additions and 2 deletions

View File

@ -1842,6 +1842,7 @@ NS_IMETHODIMP
nsSocketTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks) nsSocketTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
{ {
mCallbacks = aNotificationCallbacks; mCallbacks = aNotificationCallbacks;
mEventSink = 0;
// Get a nsIProgressEventSink so that we can fire status/progress on it- // Get a nsIProgressEventSink so that we can fire status/progress on it-
if (mCallbacks) { if (mCallbacks) {
@ -1852,8 +1853,7 @@ nsSocketTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
// Now generate a proxied event sink- // Now generate a proxied event sink-
NS_WITH_SERVICE(nsIProxyObjectManager, NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv); proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv)) {
{
rv = proxyMgr->GetProxyObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change? rv = proxyMgr->GetProxyObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink), NS_GET_IID(nsIProgressEventSink),
sink, sink,

View File

@ -504,6 +504,13 @@ nsresult nsHTTPHandler::ReleaseTransport(nsIChannel* i_pTrans)
("nsHTTPHandler::ReleaseTransport." ("nsHTTPHandler::ReleaseTransport."
"\tReleasing socket transport %x.\n", "\tReleasing socket transport %x.\n",
i_pTrans)); i_pTrans));
//
// Clear the EventSinkGetter for the transport... This breaks the
// circular reference between the HTTPChannel which holds a reference
// to the transport and the transport which references the HTTPChannel
// through the event sink...
//
rv = i_pTrans->SetNotificationCallbacks(nsnull);
rv = mTransportList->RemoveElement(i_pTrans); rv = mTransportList->RemoveElement(i_pTrans);
NS_ASSERTION(NS_SUCCEEDED(rv), "Transport not in table..."); NS_ASSERTION(NS_SUCCEEDED(rv), "Transport not in table...");