1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Detach WebTab when removing tab

That way tab is removed from parent and children before
it is removed from tabbar.
This commit is contained in:
David Rosca 2018-01-30 21:14:35 +01:00
parent 72c4b605a5
commit 1b473ac580
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 10 additions and 16 deletions

View File

@ -441,7 +441,7 @@ void TabWidget::closeTab(int index)
m_lastBackgroundTabIndex = -1; m_lastBackgroundTabIndex = -1;
removeTab(index); webTab->detach();
webTab->deleteLater(); webTab->deleteLater();
updateClosedTabsButton(); updateClosedTabsButton();

View File

@ -177,19 +177,6 @@ WebTab::WebTab(BrowserWindow* window)
}); });
} }
WebTab::~WebTab()
{
if (m_parentTab) {
m_parentTab->m_childTabs.removeOne(this);
emit m_parentTab->childTabRemoved(this);
}
const auto childTabs = m_childTabs; // modified in loop
for (WebTab *child : childTabs) {
child->setParentTab(nullptr);
}
}
TabbedWebView* WebTab::webView() const TabbedWebView* WebTab::webView() const
{ {
return m_webView; return m_webView;
@ -293,7 +280,15 @@ void WebTab::detach()
Q_ASSERT(m_tabBar); Q_ASSERT(m_tabBar);
// Remove parent tab // Remove parent tab
setParentTab(nullptr); if (m_parentTab) {
m_parentTab->m_childTabs.removeOne(this);
emit m_parentTab->childTabRemoved(this);
}
// Remove from child tabs
const auto childTabs = m_childTabs;
for (WebTab *child : childTabs) {
child->setParentTab(nullptr);
}
// Remove icon from tab // Remove icon from tab
m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), nullptr); m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), nullptr);

View File

@ -59,7 +59,6 @@ public:
}; };
explicit WebTab(BrowserWindow* window); explicit WebTab(BrowserWindow* window);
~WebTab();
TabbedWebView* webView() const; TabbedWebView* webView() const;
LocationBar* locationBar() const; LocationBar* locationBar() const;