From 1049576349afd9037f45eac245f2f5663b884228 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 8 Jun 2023 09:13:41 +0800 Subject: [PATCH 1/5] Update DockAreaTabBar.cpp Sometimes the synchronous calculation of the rectangular area fails --- src/DockAreaTabBar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 1b26435..898fc48 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,9 @@ void DockAreaTabBarPrivate::updateTabs() { TabWidget->show(); TabWidget->setActiveTab(true); - _this->ensureWidgetVisible(TabWidget); + QTimer::singleShot(0, [&, TabWidget]{ + _this->ensureWidgetVisible(TabWidget); + }); } else { From ccbde05fb763cbe25af94571cfd83caedee4dc9d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 14 Jun 2023 09:42:47 +0800 Subject: [PATCH 2/5] Update DockAreaWidget.cpp memory leak --- src/DockAreaWidget.cpp | 1 + 1 file changed, 1 insertion(+) 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; } From c08d91687ad5d11323a735df4ed7b0220a865385 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 14 Jun 2023 12:07:45 +0800 Subject: [PATCH 3/5] Update FloatingDockContainer.cpp saveState() may use the floatingDockContainer to be deleted --- src/FloatingDockContainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 0a2cdc7..6e5e712 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -1133,6 +1133,10 @@ void CFloatingDockContainer::hideAndDeleteLater() d->AutoHideChildren = false; hide(); deleteLater(); + if (d->DockManager) + { + d->DockManager->removeFloatingWidget(this); + } } //============================================================================ From 916df28fcd5b6fda4e1cbdbe367c9ec10f7d721a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Jun 2023 17:37:31 +0800 Subject: [PATCH 4/5] Update FloatingDockContainer.cpp remove dock container --- src/FloatingDockContainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 6e5e712..927910d 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -1136,6 +1136,7 @@ void CFloatingDockContainer::hideAndDeleteLater() if (d->DockManager) { d->DockManager->removeFloatingWidget(this); + d->DockManager->removeDockContainer(this->dockContainer()); } } From c552fef134e7fcd5f89a6929f79c887a487fad25 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Mon, 19 Jun 2023 10:02:19 +0200 Subject: [PATCH 5/5] Added documentation for the queued _this->ensureWidgetVisible(TabWidget) call --- src/DockAreaTabBar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 898fc48..48e3c22 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -108,6 +108,9 @@ void DockAreaTabBarPrivate::updateTabs() { TabWidget->show(); TabWidget->setActiveTab(true); + // 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); });