diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 1b26435..48e3c22 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "FloatingDockContainer.h" #include "DockAreaWidget.h" @@ -107,7 +108,12 @@ void DockAreaTabBarPrivate::updateTabs() { TabWidget->show(); TabWidget->setActiveTab(true); - _this->ensureWidgetVisible(TabWidget); + // Sometimes the synchronous calculation of the rectangular area fails + // Therefore we use QTimer::singleShot here to execute the call + // within the event loop - see #520 + QTimer::singleShot(0, [&, TabWidget]{ + _this->ensureWidgetVisible(TabWidget); + }); } else { diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index d44115e..c1d8d55 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -140,6 +140,7 @@ public: { LayoutItem->widget()->setParent(nullptr); } + delete LayoutItem; m_CurrentWidget = nullptr; m_CurrentIndex = -1; } diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 0a2cdc7..927910d 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -1133,6 +1133,11 @@ void CFloatingDockContainer::hideAndDeleteLater() d->AutoHideChildren = false; hide(); deleteLater(); + if (d->DockManager) + { + d->DockManager->removeFloatingWidget(this); + d->DockManager->removeDockContainer(this->dockContainer()); + } } //============================================================================