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

View File

@ -504,6 +504,13 @@ nsresult nsHTTPHandler::ReleaseTransport(nsIChannel* i_pTrans)
("nsHTTPHandler::ReleaseTransport."
"\tReleasing socket transport %x.\n",
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);
NS_ASSERTION(NS_SUCCEEDED(rv), "Transport not in table...");