Bug 1261752. Part 2. r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 10 May 2016 22:58:47 -0500
changeset 335919 ed485cc76a622813190f3da12d27f79032bdbade
parent 335918 34fe8a381ee93b850e8d7c0f64dd9a9eaa0de446
child 335920 433c854c4bb5d5ee4820f4622d16b7e9840ccab3
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1261752
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1261752. Part 2. r=mats
view/nsViewManager.cpp
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -395,17 +395,17 @@ nsViewManager::ProcessPendingUpdatesForV
       }
     }
     view = nsView::GetViewFor(widgets[i]);
     if (view) {
       view->ResetWidgetBounds(false, true);
     }
   }
   if (rootShell->GetViewManager() != this) {
-    return; // 'this' might have been destroyed
+    return; // presentation might have been torn down
   }
   if (aFlushDirtyRegion) {
     profiler_tracing("Paint", "DisplayList", TRACING_INTERVAL_START);
     nsAutoScriptBlocker scriptBlocker;
     SetPainting(true);
     for (uint32_t i = 0; i < widgets.Length(); ++i) {
       nsIWidget* widget = widgets[i];
       nsView* view = nsView::GetViewFor(widget);
@@ -1105,32 +1105,34 @@ nsViewManager::ProcessPendingUpdates()
     RootViewManager()->ProcessPendingUpdates();
     return;
   }
 
   // Flush things like reflows by calling WillPaint on observer presShells.
   if (mPresShell) {
     mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
 
+    RefPtr<nsViewManager> strongThis(this);
     CallWillPaintOnObservers();
 
     ProcessPendingUpdatesForView(mRootView, true);
   }
 }
 
 void
 nsViewManager::UpdateWidgetGeometry()
 {
   if (!IsRootVM()) {
     RootViewManager()->UpdateWidgetGeometry();
     return;
   }
 
   if (mHasPendingWidgetGeometryChanges) {
     mHasPendingWidgetGeometryChanges = false;
+    RefPtr<nsViewManager> strongThis(this);
     ProcessPendingUpdatesForView(mRootView, false);
   }
 }
 
 void
 nsViewManager::CallWillPaintOnObservers()
 {
   NS_PRECONDITION(IsRootVM(), "Must be root VM for this to be called!");