Bladeren bron

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.
Andreas Kling 5 jaren geleden
bovenliggende
commit
c458327429
1 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 3 3
      Libraries/LibHTML/HtmlView.cpp

+ 3 - 3
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