Bug 1261752. Part 2. r=mats a=ritu
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 10 May 2016 22:58:47 -0500
changeset 324378 9910c3c3639ff537d3407e69a2558bf2ce4dc3eb
parent 324377 00774a92ff12859050db769eba21398aa17606db
child 324379 2dfed599855f01b10f58f43283e8e47b9e3bbf74
push id5992
push userkwierso@gmail.com
push dateSat, 14 May 2016 00:16:42 +0000
treeherdermozilla-beta@a9e1d0bc8a8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats, ritu
bugs1261752
milestone47.0
Bug 1261752. Part 2. r=mats a=ritu
view/nsViewManager.cpp
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -380,17 +380,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);
@@ -1090,32 +1090,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!");