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.5
Change-Id: I94dffe162023c12bda1f801236ae4462229601b5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 12dfc8d5ed4756f15a9ce5252af80d3daa9fa074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b7aae992470d3a9e7beb57e3bd66259bbed11a53)
This commit is contained in:
Axel Spoerl 2025-04-07 13:52:47 +02:00 committed by Qt Cherry-pick Bot
parent a4a98a74ca
commit 0902a10ba9

View File

@ -733,6 +733,7 @@ void QDockWidgetGroupWindow::destroyIfSingleItemLeft()
reparentToMainWindow(lastDockWidget);
// the group window could still have placeholder items => clear everything
layoutInfo()->deleteAllLayoutItems();
layoutInfo()->item_list.clear();
destroyOrHideIfEmpty();