From 40beef964b4e469d2ff9a0715a68486ca7d52b76 Mon Sep 17 00:00:00 2001 From: gafusss Date: Sat, 4 Nov 2023 08:49:01 +0300 Subject: [PATCH] Fix memory leak in CDockContainerWidget::restoreState (#576) delete old root splitter layout item --- src/DockContainerWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index b7f8b2f..85ce8ea 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1932,10 +1932,11 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing) NewRootSplitter = d->newSplitter(Qt::Horizontal); } - d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter); + QLayoutItem* li = d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter); auto OldRoot = d->RootSplitter; d->RootSplitter = qobject_cast(NewRootSplitter); OldRoot->deleteLater(); + delete li; return true; }