From 4850a2d272d6244c306fcce658c462bc05c14744 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 13 Sep 2022 12:18:32 -0400 Subject: [PATCH] Ladybird: Update pointer to current tab when the selected tab changes This allows requests like dumping the DOM tree to be forwarded to the correct tab. Otherwise, the event would be forwarded to the most recently created tab. --- Ladybird/BrowserWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp index 232d4221b5..c18f84b459 100644 --- a/Ladybird/BrowserWindow.cpp +++ b/Ladybird/BrowserWindow.cpp @@ -10,6 +10,7 @@ #include "Settings.h" #include "SettingsDialog.h" #include "WebView.h" +#include #include #include #include @@ -190,6 +191,7 @@ BrowserWindow::BrowserWindow() QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) { setWindowTitle(QString("%1 - Ladybird").arg(m_tabs_container->tabText(index))); setWindowIcon(m_tabs_container->tabIcon(index)); + m_current_tab = verify_cast(m_tabs_container->widget(index)); }); QObject::connect(m_tabs_container, &QTabWidget::tabCloseRequested, this, &BrowserWindow::close_tab); QObject::connect(close_current_tab_action, &QAction::triggered, this, &BrowserWindow::close_current_tab);