From c279f7ffe84b3c2efc21f471adb1be184abb8191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 20 Jun 2023 08:58:10 +0000 Subject: [PATCH] Bug 1839066 - Make nsTreeBodyFrame::SetView deal with setting the same view. r=mak This actually fixes the bug. The issue is that we end up with nsITreeView.setTree(null) then nsITreeView.setTree(). This code deals with the first call: https://searchfox.org/mozilla-central/rev/c936f47f3a629ae49a4d528d3366bf29f2d4e4a7/browser/components/places/content/treeView.js#1651 But the later call doesn't restore the state properly and a bunch of nodes end up unparented. That might be worth fixing on its own... This is probably a long/forever-standing bug that was uncovered by different amount of reflow calls. Depends on D181379 Differential Revision: https://phabricator.services.mozilla.com/D181380 --- layout/xul/tree/nsTreeBodyFrame.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 7f4a9f3e76c1..70580963139c 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -452,6 +452,10 @@ nsresult nsTreeBodyFrame::GetView(nsITreeView** aView) { } nsresult nsTreeBodyFrame::SetView(nsITreeView* aView) { + if (aView == mView) { + return NS_OK; + } + // First clear out the old view. nsCOMPtr oldView = std::move(mView); if (oldView) {