Prevent deletion of DockWidgetSideTabs if SideTabBar is deleted - the DockWidget is the real owner

This commit is contained in:
Uwe Kindler 2022-10-27 10:23:11 +02:00
parent c94155fb06
commit 11223bf664

View File

@ -110,6 +110,13 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) :
//============================================================================ //============================================================================
CSideTabBar::~CSideTabBar() CSideTabBar::~CSideTabBar()
{ {
// The SideTabeBar is not the owner of the tabs and to prevent deletion
// we set the parent here to nullptr to remove it from the children
auto Tabs = findChildren<CDockWidgetSideTab*>(QString(), Qt::FindDirectChildrenOnly);
for (auto Tab : Tabs)
{
Tab->setParent(nullptr);
}
delete d; delete d;
} }