Bug 354611, Crash [@ nsXULElement::HideWindowChrome] setting hidechrome to true, r=enndeakin, sr=neil

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-11-23 15:55:58 +00:00
parent e7bf3029de
commit f5aa214f8b

View File

@ -2379,7 +2379,7 @@ nsresult
nsXULElement::HideWindowChrome(PRBool aShouldHide)
{
nsIDocument* doc = GetCurrentDoc();
if (!doc)
if (!doc || doc->GetRootContent() != this)
return NS_ERROR_UNEXPECTED;
nsIPresShell *shell = doc->GetShellAt(0);
@ -2394,8 +2394,9 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
nsIView* view = frame->GetClosestView();
if (view) {
// XXXldb Um, not all views have widgets...
view->GetWidget()->HideWindowChrome(aShouldHide);
nsIWidget* w = view->GetWidget();
NS_ENSURE_STATE(w);
w->HideWindowChrome(aShouldHide);
}
}
}