mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Ladybird: Close inspector and JS console when tab closes
Keeping these around can lead to use-after-frees and crashes.
This commit is contained in:
parent
33249c727a
commit
678dfa8f75
2 changed files with 9 additions and 5 deletions
|
@ -77,7 +77,7 @@ WebContentView::WebContentView(StringView webdriver_content_ipc_path)
|
||||||
|
|
||||||
WebContentView::~WebContentView()
|
WebContentView::~WebContentView()
|
||||||
{
|
{
|
||||||
clear_inspector_callbacks();
|
close_sub_widgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentView::load(AK::URL const& url)
|
void WebContentView::load(AK::URL const& url)
|
||||||
|
@ -515,10 +515,14 @@ void WebContentView::ensure_inspector_widget()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentView::clear_inspector_callbacks()
|
void WebContentView::close_sub_widgets()
|
||||||
{
|
{
|
||||||
if (m_inspector_widget)
|
auto close_widget_window = [](auto* widget) {
|
||||||
m_inspector_widget->on_close = nullptr;
|
if (widget)
|
||||||
|
widget->close();
|
||||||
|
};
|
||||||
|
close_widget_window(m_console_widget);
|
||||||
|
close_widget_window(m_inspector_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContentView::is_inspector_open() const
|
bool WebContentView::is_inspector_open() const
|
||||||
|
|
|
@ -192,7 +192,7 @@ private:
|
||||||
bool is_inspector_open() const;
|
bool is_inspector_open() const;
|
||||||
void inspect_dom_tree();
|
void inspect_dom_tree();
|
||||||
void clear_inspected_dom_node();
|
void clear_inspected_dom_node();
|
||||||
void clear_inspector_callbacks();
|
void close_sub_widgets();
|
||||||
ErrorOr<Ladybird::DOMNodeProperties> inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element);
|
ErrorOr<Ladybird::DOMNodeProperties> inspect_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> pseudo_element);
|
||||||
|
|
||||||
qreal m_inverse_pixel_scaling_ratio { 1.0 };
|
qreal m_inverse_pixel_scaling_ratio { 1.0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue