diff --git a/autotests/webtabtest.cpp b/autotests/webtabtest.cpp index da204393f..b5a55de76 100644 --- a/autotests/webtabtest.cpp +++ b/autotests/webtabtest.cpp @@ -71,6 +71,10 @@ void WebTabTest::parentChildTabsTest() QCOMPARE(tab3.childTabs(), QVector{&tab4}); QCOMPARE(tab4.parentTab(), &tab3); + tab3.addChildTab(&tab2); + QCOMPARE(tab3.childTabs(), (QVector{&tab4, &tab2})); + QCOMPARE(tab1.childTabs(), (QVector{&tab3, &tab5, &tab6})); + QTest::qWait(10); } diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 6c9b9aec7..d943da160 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -446,9 +446,8 @@ void WebTab::addChildTab(WebTab *tab, int index) return; } - tab->m_parentTab = this; - WebTab *tabParent = tab->m_parentTab; + tab->m_parentTab = this; if (tabParent) { const int index = tabParent->m_childTabs.indexOf(tab); if (index >= 0) {