Ladybird: Close the current tab even if we're closing the window

Currently, if the JS console is open and tied to the last opened tab in
the browser window, it will prevent the main process from exiting when
the last tab is closed. This change explicitly closes that tab before
closing the window (if it's the last tab), allowing Qt to delete the
Tab object.
This commit is contained in:
Timothy Flynn 2023-08-08 18:42:18 -04:00 committed by Andreas Kling
parent b326a301c3
commit 59b583329a
Notes: sideshowbarker 2024-07-17 04:03:27 +09:00

View file

@ -521,11 +521,10 @@ void BrowserWindow::open_file()
void BrowserWindow::close_current_tab()
{
auto count = m_tabs_container->count() - 1;
if (!count)
close_tab(m_tabs_container->currentIndex());
if (m_tabs_container->count() == 0)
close();
else
close_tab(m_tabs_container->currentIndex());
}
int BrowserWindow::tab_index(Tab* tab)