Bug 1322107 - Scope local presshell variable in less error prone way. r=mccr8, a=dveditz
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 19 Dec 2016 16:48:23 -0500
changeset 353210 0cd75d95f3c07992b92731780dcd0119cbc4df19
parent 353209 1ece17e26bee22710a98ff2ea2e844763ac5a7dc
child 353211 8d9fb8fa1f3db54852a586c145f2ed5afe00f27c
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, dveditz
bugs1322107
milestone52.0a2
Bug 1322107 - Scope local presshell variable in less error prone way. r=mccr8, a=dveditz
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4076,20 +4076,21 @@ PresShell::FlushPendingNotifications(moz
     isSafeToFlush = isSafeToFlush && nsContentUtils::IsSafeToRunScript();
   }
 
   NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager");
   // Make sure the view manager stays alive.
   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();
       if (mIsDestroying) {
         return;
       }
     }