--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -539,17 +539,19 @@ NS_IMETHODIMP nsTreeBodyFrame::SetView(n
sel->SetTree(mTreeBoxObject);
}
else {
NS_NewTreeSelection(mTreeBoxObject, getter_AddRefs(sel));
mView->SetSelection(sel);
}
// View, meet the tree.
+ nsWeakFrame weakFrame(this);
mView->SetTree(mTreeBoxObject);
+ NS_ENSURE_STATE(weakFrame.IsAlive());
mView->GetRowCount(&mRowCount);
PRBool isInReflow;
PresContext()->PresShell()->IsReflowLocked(&isInReflow);
if (!isInReflow) {
// The scrollbar will need to be updated.
FullScrollbarsUpdate(PR_FALSE);
} else if (!mReflowCallbackPosted) {