Fix memory leak in CDockContainerWidget::restoreState (#576)

delete old root splitter layout item
This commit is contained in:
gafusss 2023-11-04 08:49:01 +03:00 committed by GitHub
parent 420baeedfe
commit 40beef964b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1932,10 +1932,11 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
NewRootSplitter = d->newSplitter(Qt::Horizontal); NewRootSplitter = d->newSplitter(Qt::Horizontal);
} }
d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter); QLayoutItem* li = d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter);
auto OldRoot = d->RootSplitter; auto OldRoot = d->RootSplitter;
d->RootSplitter = qobject_cast<CDockSplitter*>(NewRootSplitter); d->RootSplitter = qobject_cast<CDockSplitter*>(NewRootSplitter);
OldRoot->deleteLater(); OldRoot->deleteLater();
delete li;
return true; return true;
} }