diff --git a/mozilla/layout/xul/base/src/nsBoxObject.cpp b/mozilla/layout/xul/base/src/nsBoxObject.cpp index 9c8fc5795a5..c8c80ed3721 100644 --- a/mozilla/layout/xul/base/src/nsBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsBoxObject.cpp @@ -184,13 +184,14 @@ nsBoxObject::GetOffsetRect(nsRect& aRect) nsCOMPtr doc = mContent->GetDocument(); if (doc) { + // Flush all pending notifications so that our frames are uptodate. Must + // do this before we get the presshell, since this can destroy presshells. + doc->FlushPendingNotifications(Flush_Layout); + // Get Presentation shell 0 nsIPresShell *presShell = doc->GetShellAt(0); if(presShell) { - // Flush all pending notifications so that our frames are uptodate - doc->FlushPendingNotifications(Flush_Layout); - // Get the Frame for our content nsIFrame* frame = nsnull; presShell->GetPrimaryFrameFor(mContent, &frame);