Bug 824643 - Return early if SetAttr destroyed the frame. r=roc
authorMats Palmgren <matspal@gmail.com>
Thu, 27 Dec 2012 22:24:08 +0100
changeset 117134 4ab11d8ed73b090ff4c3286cb56d59b940270a6f
parent 117133 06621f924ef1df64945475a5380319b2ca1de79e
child 117135 e065ba89f5c381d47feebb390f50f206fefb1b94
push id24087
push usergraememcc_firefox@graeme-online.co.uk
push dateSat, 29 Dec 2012 12:13:53 +0000
treeherdermozilla-central@b5ea211f23a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs824643
milestone20.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 824643 - Return early if SetAttr destroyed the frame. r=roc
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -868,27 +868,32 @@ nsTreeBodyFrame::ScrollParts nsTreeBodyF
 }
 
 void
 nsTreeBodyFrame::UpdateScrollbars(const ScrollParts& aParts)
 {
   nscoord rowHeightAsPixels = nsPresContext::AppUnitsToIntCSSPixels(mRowHeight);
 
   if (aParts.mVScrollbar) {
+    nsWeakFrame self(this);
     nsAutoString curPos;
     curPos.AppendInt(mTopRowIndex*rowHeightAsPixels);
     aParts.mVScrollbarContent->
       SetAttr(kNameSpaceID_None, nsGkAtoms::curpos, curPos, true);
+    if (!self.IsAlive()) {
+      return;
+    }
   }
 
   if (aParts.mHScrollbar) {
     nsAutoString curPos;
     curPos.AppendInt(mHorzPosition);
     aParts.mHScrollbarContent->
       SetAttr(kNameSpaceID_None, nsGkAtoms::curpos, curPos, true);
+    // 'this' might be deleted here
   }
 }
 
 void
 nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts)
 {
   bool verticalOverflowChanged = false;
   bool horizontalOverflowChanged = false;