From 0d33609a3d8f6564e53ee90727335c89947c79f9 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 13 Mar 2007 21:21:03 +0000 Subject: [PATCH] Be a little more careful about whether we have dirty roots. Bug 332807, r+sr=dbaron --- layout/base/nsPresShell.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 15f5164a765b..060021f0fba5 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5765,11 +5765,11 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) if (0 != mDirtyRoots.Count()) { nsHTMLReflowMetrics desiredSize; - nsIRenderingContext* rcx; + nsCOMPtr rcx; nsIFrame* rootFrame = FrameManager()->GetRootFrame(); nsSize maxSize = rootFrame->GetSize(); - nsresult rv=CreateRenderingContext(rootFrame, &rcx); + nsresult rv=CreateRenderingContext(rootFrame, getter_AddRefs(rcx)); if (NS_FAILED(rv)) return rv; #ifdef DEBUG @@ -5791,8 +5791,11 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) mDocument->BeginUpdate(UPDATE_ALL); mDocument->EndUpdate(UPDATE_ALL); - // Scope for the reflow entry point - { + // That might have executed (via XBL binding constructors). So we may no + // longer have reflow commands. In fact, we may have had Destroy() called. + + // Scope for the reflow entry point, in addition to the |if| condition. + if (!mIsDestroying && mDirtyRoots.Count() != 0) { AUTO_LAYOUT_PHASE_ENTRY_POINT(GetPresContext(), Reflow); mIsReflowing = PR_TRUE; @@ -5882,8 +5885,6 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) mIsReflowing = PR_FALSE; } - NS_IF_RELEASE(rcx); - // If any new reflow commands were enqueued during the reflow, // schedule another reflow event to process them. if (mDirtyRoots.Count())