Bug 1322107 - Scope local presshell variable in less error prone way. r=mccr8

This commit is contained in:
Olli Pettay
2016-12-19 16:48:23 -05:00
parent 7dbd258c0d
commit 87372114dc

View File

@@ -4061,10 +4061,11 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
RefPtr<nsViewManager> viewManager = mViewManager;
bool didStyleFlush = false;
bool didLayoutFlush = false;
nsCOMPtr<nsIPresShell> kungFuDeathGrip;
if (isSafeToFlush && viewManager) {
// Processing pending notifications can kill us, and some callers only
// hold weak refs when calling FlushPendingNotifications(). :(
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
kungFuDeathGrip = this;
if (mResizeEvent.IsPending()) {
FireResizeEvent();