diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 1c27f981937..a7c8f88ec2c 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1232,12 +1232,30 @@ NS_IMETHODIMP nsDocShell::Create() NS_IMETHODIMP nsDocShell::Destroy() { + // Stop any URLs that are currently being loaded... + Stop(); + if(mDocLoader) + { + mDocLoader->Destroy(); + mDocLoader->SetContainer(nsnull); + } + + SetDocLoaderObserver(nsnull); + + // Remove this docshell from its parent's child list + nsCOMPtr docShellParentAsNode(do_QueryInterface(mParent)); + if(docShellParentAsNode) + docShellParentAsNode->RemoveChild(this); + + DestroyChildren(); + mContentViewer = nsnull; mDocLoader = nsnull; mDocLoaderObserver = nsnull; mParentWidget = nsnull; mPrefs = nsnull; mCurrentURI = nsnull; + mWebProgressListenerList = nsnull; if(mScriptGlobal) { @@ -1254,7 +1272,7 @@ NS_IMETHODIMP nsDocShell::Destroy() mScriptContext = nsnull; mSessionHistory = nsnull; mLoadCookie = nsnull; - mTreeOwner = nsnull; + SetTreeOwner(nsnull); if(mInitInfo) { @@ -1268,7 +1286,6 @@ NS_IMETHODIMP nsDocShell::Destroy() NS_RELEASE(mContentListener); } - return NS_OK; }