Fix for bug 24306. The DocumentViewer now cleans up dangling webshell references in the PresContext. nsGenericElement::TriggerLink deals with a nonexistent handler (it might have been deleted already as part of event processing). r=buster, joki

This commit is contained in:
vidur%netscape.com 2000-02-02 23:40:22 +00:00
parent 2928361af0
commit f77571182e
5 changed files with 19 additions and 6 deletions

View File

@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl()
mDocument->SetScriptGlobalObject(nsnull);
}
if (mPresContext) {
mPresContext->SetContainer(nsnull);
mPresContext->SetLinkHandler(nsnull);
}
if (mDeviceContext)
mDeviceContext->FlushFontCache();

View File

@ -1275,9 +1275,8 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext,
{
nsCOMPtr<nsILinkHandler> handler;
nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler));
if (NS_FAILED(rv)) return rv;
if (!handler) return NS_ERROR_UNEXPECTED; // this can happen in editor windows
if (NS_FAILED(rv) || (nsnull == handler)) return rv;
// Resolve url to an absolute url
nsAutoString absURLSpec;
if (nsnull != aBaseURL) {

View File

@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl()
mDocument->SetScriptGlobalObject(nsnull);
}
if (mPresContext) {
mPresContext->SetContainer(nsnull);
mPresContext->SetLinkHandler(nsnull);
}
if (mDeviceContext)
mDeviceContext->FlushFontCache();

View File

@ -325,6 +325,11 @@ DocumentViewerImpl::~DocumentViewerImpl()
mDocument->SetScriptGlobalObject(nsnull);
}
if (mPresContext) {
mPresContext->SetContainer(nsnull);
mPresContext->SetLinkHandler(nsnull);
}
if (mDeviceContext)
mDeviceContext->FlushFontCache();

View File

@ -1275,9 +1275,8 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext,
{
nsCOMPtr<nsILinkHandler> handler;
nsresult rv = aPresContext->GetLinkHandler(getter_AddRefs(handler));
if (NS_FAILED(rv)) return rv;
if (!handler) return NS_ERROR_UNEXPECTED; // this can happen in editor windows
if (NS_FAILED(rv) || (nsnull == handler)) return rv;
// Resolve url to an absolute url
nsAutoString absURLSpec;
if (nsnull != aBaseURL) {