Fix memory leaks (#314)

This commit is contained in:
jporcher 2021-04-20 14:25:30 +02:00 committed by GitHub
parent ffa0105d3e
commit 2f041a0eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -505,6 +505,20 @@ CDockManager::CDockManager(QWidget *parent) :
//============================================================================ //============================================================================
CDockManager::~CDockManager() CDockManager::~CDockManager()
{ {
// fix memory leaks, see https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/307
std::vector<ads::CDockAreaWidget*> areas;
for ( int i = 0; i != dockAreaCount(); ++i )
{
areas.push_back( dockArea(i) );
}
for ( auto area : areas )
{
for ( auto widget : area->dockWidgets() )
delete widget;
delete area;
}
auto FloatingWidgets = d->FloatingWidgets; auto FloatingWidgets = d->FloatingWidgets;
for (auto FloatingWidget : FloatingWidgets) for (auto FloatingWidget : FloatingWidgets)
{ {