# HG changeset patch
# User Timothy Nikkel <tnikkel@gmail.com>
# Date 1462939106 18000
#      Tue May 10 22:58:26 2016 -0500
# Branch THUNDERBIRD3880_2016050308_RELBRANCH
# Node ID 520a987184b81831a68c3d5977c1ee36afbeeeb0
# Parent  19248f256dd33e2d42edacf4485141c9b3e27ecf
Bug 1261752. Part 1. r=mats a=ritu

diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -411,17 +411,17 @@
 }
 
 void
 nsViewManager::ProcessPendingUpdatesPaint(nsIWidget* aWidget)
 {
   if (aWidget->NeedsPaint()) {
     // If an ancestor widget was hidden and then shown, we could
     // have a delayed resize to handle.
-    for (nsViewManager *vm = this; vm;
+    for (RefPtr<nsViewManager> vm = this; vm;
          vm = vm->mRootView->GetParent()
            ? vm->mRootView->GetParent()->GetViewManager()
            : nullptr) {
       if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
           vm->mRootView->IsEffectivelyVisible() &&
           vm->mPresShell && vm->mPresShell->IsVisible()) {
         vm->FlushDelayedResize(true);
       }
