Selaa lähdekoodia

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.
Timothy Flynn 2 vuotta sitten
vanhempi
commit
59b583329a
1 muutettua tiedostoa jossa 3 lisäystä ja 4 poistoa
  1. 3 4
      Ladybird/Qt/BrowserWindow.cpp

+ 3 - 4
Ladybird/Qt/BrowserWindow.cpp

@@ -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)