Skip to content

Commit 2f041a0

Browse files
authored
Fix memory leaks (#314)
1 parent ffa0105 commit 2f041a0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/DockManager.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,20 @@ CDockManager::CDockManager(QWidget *parent) :
505505
//============================================================================
506506
CDockManager::~CDockManager()
507507
{
508+
// fix memory leaks, see https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/307
509+
std::vector<ads::CDockAreaWidget*> areas;
510+
for ( int i = 0; i != dockAreaCount(); ++i )
511+
{
512+
areas.push_back( dockArea(i) );
513+
}
514+
for ( auto area : areas )
515+
{
516+
for ( auto widget : area->dockWidgets() )
517+
delete widget;
518+
519+
delete area;
520+
}
521+
508522
auto FloatingWidgets = d->FloatingWidgets;
509523
for (auto FloatingWidget : FloatingWidgets)
510524
{

0 commit comments

Comments
 (0)