From b7aae992470d3a9e7beb57e3bd66259bbed11a53 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Mon, 7 Apr 2025 13:52:47 +0200 Subject: [PATCH] QDockWidgetGroupWindow: Properly destroy gap items and separators QDockWidgetGroupWindow::destroyIfSingleItemLeft() cleared the item list without checking for gap or separator items. When a QDockWidget was deleted during an active drag, these items were leaked. Call deleteAllLayoutItems() before clearing the item list. Amends e6d85cf28bc4f750b69c33b72c006b067ae1190f. Task-number: QTBUG-135442 Pick-to: 6.8 6.5 Change-Id: I94dffe162023c12bda1f801236ae4462229601b5 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Marc Mutz (cherry picked from commit 12dfc8d5ed4756f15a9ce5252af80d3daa9fa074) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/widgets/qmainwindowlayout.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index b81b17a64ba..869fc49c021 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -732,6 +732,7 @@ void QDockWidgetGroupWindow::destroyIfSingleItemLeft() reparentToMainWindow(lastDockWidget); // the group window could still have placeholder items => clear everything + layoutInfo()->deleteAllLayoutItems(); layoutInfo()->item_list.clear(); destroyOrHideIfEmpty();