Fixed crash caused by changes related to issue #594 - deletion of CFloatingWidget caused crash when loading a state from XML

This commit is contained in:
Uwe Kindler 2024-01-26 16:31:04 +01:00
parent ed6636ae26
commit 644c828f00
3 changed files with 20 additions and 6 deletions

View File

@ -566,6 +566,7 @@ CDockManager::~CDockManager()
auto FloatingWidgets = d->FloatingWidgets;
for (auto FloatingWidget : FloatingWidgets)
{
FloatingWidget->deleteContent();
delete FloatingWidget;
}

View File

@ -760,10 +760,22 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget *DockWidget) :
d->DockManager->notifyWidgetOrAreaRelocation(DockWidget);
}
//============================================================================
CFloatingDockContainer::~CFloatingDockContainer()
{
ADS_PRINT("~CFloatingDockContainer");
if (d->DockManager)
{
d->DockManager->removeFloatingWidget(this);
}
delete d;
}
//============================================================================
void CFloatingDockContainer::deleteContent()
{
std::vector<QPointer<ads::CDockAreaWidget>> areas;
for (int i = 0; i != dockContainer()->dockAreaCount(); ++i)
{
@ -788,12 +800,6 @@ CFloatingDockContainer::~CFloatingDockContainer()
delete ptrWdg;
}
}
if (d->DockManager)
{
d->DockManager->removeFloatingWidget(this);
}
delete d;
}
//============================================================================

View File

@ -146,6 +146,13 @@ protected:
*/
virtual void finishDragging() override;
/**
* This function deletes all dock widgets in it.
* This functions should be called only from dock manager in its
* destructor before deleting the floating widget
*/
void deleteContent();
/**
* Call this function if you just want to initialize the position
* and size of the floating widget