diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 2ebf4a5..87f4053 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -764,6 +764,31 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget *DockWidget) : CFloatingDockContainer::~CFloatingDockContainer() { ADS_PRINT("~CFloatingDockContainer"); + std::vector> areas; + for (int i = 0; i != dockContainer()->dockAreaCount(); ++i) + { + areas.push_back( dockContainer()->dockArea(i) ); + } + for (auto area : areas) + { + if (!area) + { + continue; + } + + // QPointer delete safety - just in case some dock wigdet in destruction + // deletes another related/twin or child dock widget. + std::vector> deleteWidgets; + for (auto widget : area->dockWidgets()) + { + deleteWidgets.push_back(widget); + } + for (auto ptrWdg : deleteWidgets) + { + delete ptrWdg; + } + } + if (d->DockManager) { d->DockManager->removeFloatingWidget(this);