1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

LibWeb: Fix Document construction mishap in <template> element

Ref-counted objects must not be stack allocated. Make DOM::Document's
constructor private to avoid this issue. (I wish we could mark classes
as heap-only..)
This commit is contained in:
Andreas Kling 2020-10-23 08:31:26 +02:00
parent 691b105885
commit 46c15276e9
7 changed files with 11 additions and 9 deletions

View file

@ -47,7 +47,7 @@ ConsoleWidget::ConsoleWidget()
set_layout<GUI::VerticalBoxLayout>();
set_fill_with_background_color(true);
auto base_document = adopt(*new Web::DOM::Document);
auto base_document = Web::DOM::Document::create();
base_document->append_child(adopt(*new Web::DOM::DocumentType(base_document)));
auto html_element = base_document->create_element("html");
base_document->append_child(html_element);

View file

@ -40,7 +40,7 @@ NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create()
IRCLogBuffer::IRCLogBuffer()
{
m_document = adopt(*new Web::DOM::Document);
m_document = Web::DOM::Document::create();
m_document->append_child(adopt(*new Web::DOM::DocumentType(document())));
auto html_element = m_document->create_element("html");
m_document->append_child(html_element);