diff --git a/examples/dockindock/main.cpp b/examples/dockindock/main.cpp index 83e8bb7..9ae3539 100644 --- a/examples/dockindock/main.cpp +++ b/examples/dockindock/main.cpp @@ -1,5 +1,5 @@ #include -#include "../../examples/simple/MainWindow.h" +#include "mainframe.h" int main(int argc, char *argv[]) { diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 8549a13..0f87c58 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -539,7 +539,14 @@ CDockManager::~CDockManager() std::vector areas; for ( int i = 0; i != dockAreaCount(); ++i ) { - areas.push_back( dockArea(i) ); + auto area = dockArea(i); + if ( area->dockManager() == this ) + areas.push_back( area ); + // else, this is surprising, looks like this CDockAreaWidget is child of two different CDockManager + // this is reproductible by https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/585 testcase + // then, when a CDockManager deletes itself, it deletes the CDockAreaWidget, then, the other + // CDockManager will try to delete the CDockAreaWidget again and this will crash + // So let's just delete CDockAreaWidget we are the parent of! } for ( auto area : areas ) {