From 11223bf6640f17992aaed860255c6e1314582aed Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 27 Oct 2022 10:23:11 +0200 Subject: [PATCH] Prevent deletion of DockWidgetSideTabs if SideTabBar is deleted - the DockWidget is the real owner --- src/SideTabBar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 610e40b..3089983 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -110,6 +110,13 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : //============================================================================ 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(QString(), Qt::FindDirectChildrenOnly); + for (auto Tab : Tabs) + { + Tab->setParent(nullptr); + } delete d; }