Bug 1261752. Part 2. r=mats a=ritu
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 10 May 2016 22:58:47 -0500
changeset 332872 30b2b24080072a24703e01054b56091753a415b7
parent 332871 ca2f65b2d7b370d4593c9d321b31a92679e8fe10
child 332873 65b8174889df723c25260306e0a1b00157470d9c
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats, ritu
bugs1261752
milestone48.0a2
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!");