diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 042761bdb4e..021c13c29e9 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -199,18 +199,11 @@ nsWebShell::~nsWebShell() Destroy(); // Stop any pending document loads and destroy the loader... - if (nsnull != mDocLoader) { + if (mDocLoader) { mDocLoader->Stop(); mDocLoader->SetContainer(nsnull); mDocLoader->Destroy(); -// turn on to track docloader leaks -#if 0 - nsrefcnt refcnt; - NS_RELEASE2(mDocLoader, refcnt); - NS_ASSERTION(refcnt == 0, "Still have a docloader? who owns it?!"); -#else - NS_RELEASE(mDocLoader); -#endif + mDocLoader = nsnull; } // Cancel any timers that were set for this loader. CancelRefreshURITimers(); @@ -361,8 +354,10 @@ NS_IMETHODIMP nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult) { aResult = mDocLoader; - NS_IF_ADDREF(mDocLoader); - return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE; + if (!mDocLoader) + return NS_ERROR_FAILURE; + NS_ADDREF(aResult); + return NS_OK; } //---------------------------------------------------------------------- @@ -1263,7 +1258,8 @@ NS_IMETHODIMP nsWebShell::Create() // doc loader and store it...as more of the docshell lands, we'll be able to get rid // of this hack... nsCOMPtr uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID); - uriLoader->GetDocumentLoaderForContext(NS_STATIC_CAST( nsISupports*, (nsIWebShell *) this), &mDocLoader); + uriLoader->GetDocumentLoaderForContext(NS_STATIC_CAST(nsIWebShell*, this), + getter_AddRefs(mDocLoader)); nsCOMPtr shellAsContainer = do_QueryInterface(NS_STATIC_CAST(nsIWebShell*, this)); // Set the webshell as the default IContentViewerContainer for the loader... diff --git a/mozilla/docshell/base/nsWebShell.h b/mozilla/docshell/base/nsWebShell.h index b1988224030..b023252a1e3 100644 --- a/mozilla/docshell/base/nsWebShell.h +++ b/mozilla/docshell/base/nsWebShell.h @@ -31,6 +31,7 @@ #include "nsICommandManager.h" #include "nsIIOService.h" #include "nsCRT.h" +#include "nsIDocumentLoader.h" class nsIEventQueue; class nsIController; @@ -120,7 +121,7 @@ protected: PRThread *mThread; nsIWebShellContainer* mContainer; - nsIDocumentLoader* mDocLoader; + nsCOMPtr mDocLoader; eCharsetReloadState mCharsetReloadState;