1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

WebTab: Fix removing from existing parent in addChildTab

This commit is contained in:
David Rosca 2018-01-31 19:46:26 +01:00
parent 1c7288204c
commit 4bb75de25c
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 5 additions and 2 deletions

View File

@ -71,6 +71,10 @@ void WebTabTest::parentChildTabsTest()
QCOMPARE(tab3.childTabs(), QVector<WebTab*>{&tab4}); QCOMPARE(tab3.childTabs(), QVector<WebTab*>{&tab4});
QCOMPARE(tab4.parentTab(), &tab3); QCOMPARE(tab4.parentTab(), &tab3);
tab3.addChildTab(&tab2);
QCOMPARE(tab3.childTabs(), (QVector<WebTab*>{&tab4, &tab2}));
QCOMPARE(tab1.childTabs(), (QVector<WebTab*>{&tab3, &tab5, &tab6}));
QTest::qWait(10); QTest::qWait(10);
} }

View File

@ -446,9 +446,8 @@ void WebTab::addChildTab(WebTab *tab, int index)
return; return;
} }
tab->m_parentTab = this;
WebTab *tabParent = tab->m_parentTab; WebTab *tabParent = tab->m_parentTab;
tab->m_parentTab = this;
if (tabParent) { if (tabParent) {
const int index = tabParent->m_childTabs.indexOf(tab); const int index = tabParent->m_childTabs.indexOf(tab);
if (index >= 0) { if (index >= 0) {