Skip to content

Commit

Permalink
Fix #585 (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
jporcher authored Dec 5, 2023
1 parent ec018a4 commit a7a97e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/dockindock/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <QApplication>
#include "../../examples/simple/MainWindow.h"
#include "mainframe.h"

int main(int argc, char *argv[])
{
Expand Down
9 changes: 8 additions & 1 deletion src/DockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,14 @@ CDockManager::~CDockManager()
std::vector<ads::CDockAreaWidget*> 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 )
{
Expand Down

0 comments on commit a7a97e6

Please sign in to comment.