Attempting to fix crashes in RetargetEventToParent (bug 303725). Leave a weak container pointer so that events targetted to cached pres shells can be sent up to the parent, and don't crash if this fails. r=aaronl, sr=dbaron.

git-svn-id: svn://10.0.0.236/trunk@178582 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com
2005-08-22 01:55:34 +00:00
parent 4a089a3fff
commit 760b97437e
3 changed files with 31 additions and 1 deletions

View File

@@ -1630,6 +1630,12 @@ nsIPresShell::GetVerifyReflowFlags()
#endif
}
void
nsIPresShell::SetForwardingContainer(nsISupports *aContainer)
{
mForwardingContainer = do_GetWeakReference(aContainer);
}
//----------------------------------------------------------------------
nsresult
@@ -5944,9 +5950,16 @@ nsresult PresShell::RetargetEventToParent(nsIView *aView,
// Next, update the display so the old focus ring is no longer visible
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
if (!container)
container = do_QueryReferent(mForwardingContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
NS_ASSERTION(docShell, "No docshell for container.");
if (!docShell) {
// We don't have any place to send this event.
NS_WARNING("dropping event, no forwarding shell");
return NS_OK;
}
nsCOMPtr<nsIContentViewer> contentViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (contentViewer) {