Skip to content

Commit a7a97e6

Browse files
authored
Fix #585 (#586)
1 parent ec018a4 commit a7a97e6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

examples/dockindock/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <QApplication>
2-
#include "../../examples/simple/MainWindow.h"
2+
#include "mainframe.h"
33

44
int main(int argc, char *argv[])
55
{

src/DockManager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,14 @@ CDockManager::~CDockManager()
539539
std::vector<ads::CDockAreaWidget*> areas;
540540
for ( int i = 0; i != dockAreaCount(); ++i )
541541
{
542-
areas.push_back( dockArea(i) );
542+
auto area = dockArea(i);
543+
if ( area->dockManager() == this )
544+
areas.push_back( area );
545+
// else, this is surprising, looks like this CDockAreaWidget is child of two different CDockManager
546+
// this is reproductible by https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/585 testcase
547+
// then, when a CDockManager deletes itself, it deletes the CDockAreaWidget, then, the other
548+
// CDockManager will try to delete the CDockAreaWidget again and this will crash
549+
// So let's just delete CDockAreaWidget we are the parent of!
543550
}
544551
for ( auto area : areas )
545552
{

0 commit comments

Comments
 (0)