From cd9e13195a496ed4ca4a9686abf2fb7f7ecb0519 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 15 Feb 2017 09:55:33 -0800 Subject: [PATCH] Bug 1338772: Move mInFlush tweak a bit closer to the actual flushing, in PresShell::FlushPendingNotifications. r=bz MozReview-Commit-ID: 9jeQVl6iX56 --- layout/base/PresShell.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index d18b18e4452d..5f4ce9bffb9c 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -4112,14 +4112,6 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) NS_ASSERTION(flushType >= FlushType::Frames, "Why did we get called?"); - // Record that we are in a flush, so that our optimization in - // nsDocument::FlushPendingNotifications doesn't skip any re-entrant - // calls to us. Otherwise, we might miss some needed flushes, since - // we clear mNeedStyleFlush / mNeedLayoutFlush here at the top of - // the function but we might not have done the work yet. - AutoRestore guard(mInFlush); - mInFlush = true; - mNeedStyleFlush = false; mNeedThrottledAnimationFlush = mNeedThrottledAnimationFlush && !aFlush.mFlushAnimations; @@ -4143,6 +4135,14 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) bool didLayoutFlush = false; nsCOMPtr kungFuDeathGrip; if (isSafeToFlush && viewManager) { + // Record that we are in a flush, so that our optimization in + // nsDocument::FlushPendingNotifications doesn't skip any re-entrant + // calls to us. Otherwise, we might miss some needed flushes, since + // we clear mNeedStyleFlush / mNeedLayoutFlush here at the top of + // the function but we might not have done the work yet. + AutoRestore guard(mInFlush); + mInFlush = true; + // Processing pending notifications can kill us, and some callers only // hold weak refs when calling FlushPendingNotifications(). :( kungFuDeathGrip = this;