From 2ebaaf5e5ce1c954e8c3e6bfb0c17cc0e412e1b6 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 13 Sep 2022 12:18:32 -0400 Subject: [PATCH] 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. --- BrowserWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BrowserWindow.cpp b/BrowserWindow.cpp index 232d4221b52..c18f84b459e 100644 --- a/BrowserWindow.cpp +++ b/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);