From 795efea64f478cdc3ad166297535ab5349f3664a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 5 Apr 2024 07:36:12 -0400 Subject: [PATCH] Ladybird/Qt: Close the browser when the last tab's close button is used We currently do this already when the last tab is closed via the ctrl-W shortcut. Move the logic for this to BrowserWindow::close_tab so that we also close the window when the tab is closed via its close button. --- Ladybird/Qt/BrowserWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index 7273e021ce3..4726e6ffc1a 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -613,6 +613,9 @@ void BrowserWindow::close_tab(int index) auto* tab = m_tabs_container->widget(index); m_tabs_container->removeTab(index); tab->deleteLater(); + + if (m_tabs_container->count() == 0) + close(); } void BrowserWindow::open_file() @@ -623,9 +626,6 @@ void BrowserWindow::open_file() void BrowserWindow::close_current_tab() { close_tab(m_tabs_container->currentIndex()); - - if (m_tabs_container->count() == 0) - close(); } int BrowserWindow::tab_index(Tab* tab)