From c45832742924a42cb1a90618bc891ed630a11dca Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 9 Oct 2019 21:53:16 +0200 Subject: [PATCH] LibHTML: Tear down the layout tree before changing the Frame's document We don't want to deal with document().frame() being null inside layout tree code, so this makes sure we tear it down before the frame has a chance to get nulled out. --- Libraries/LibHTML/HtmlView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index a1c0c8162c..36de52e889 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -52,11 +52,11 @@ void HtmlView::set_document(Document* document) }; } + m_layout_root = nullptr; + main_frame().set_document(document); - if (document == nullptr) - m_layout_root = nullptr; - else + if (document) m_layout_root = document->create_layout_tree(document->style_resolver(), nullptr); #ifdef HTML_DEBUG