mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:57:46 +00:00
Browser: Close inspectors and JS console when tab closes
Keeping these around can lead to use-after-frees and crashes.
This commit is contained in:
parent
9dea61e095
commit
e3ad5731f7
2 changed files with 20 additions and 1 deletions
|
@ -42,6 +42,11 @@
|
|||
|
||||
namespace Browser {
|
||||
|
||||
Tab::~Tab()
|
||||
{
|
||||
close_sub_widgets();
|
||||
}
|
||||
|
||||
URL url_from_user_input(DeprecatedString const& input)
|
||||
{
|
||||
if (input.starts_with('?') && !g_search_engine.is_empty())
|
||||
|
@ -674,6 +679,19 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target)
|
|||
window->move_to_front();
|
||||
}
|
||||
|
||||
void Tab::close_sub_widgets()
|
||||
{
|
||||
auto close_widget_window = [](auto& widget) {
|
||||
if (widget) {
|
||||
auto* window = widget->window();
|
||||
window->close();
|
||||
}
|
||||
};
|
||||
close_widget_window(m_dom_inspector_widget);
|
||||
close_widget_window(m_console_widget);
|
||||
close_widget_window(m_storage_widget);
|
||||
}
|
||||
|
||||
void Tab::show_console_window()
|
||||
{
|
||||
if (!m_console_widget) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue