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.9 6.8 6.5
Change-Id: I94dffe162023c12bda1f801236ae4462229601b5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Axel Spoerl 2025-04-07 13:52:47 +02:00
parent b7446b1f5b
commit 12dfc8d5ed

View File

@ -728,6 +728,7 @@ void QDockWidgetGroupWindow::destroyIfSingleItemLeft()
reparentToMainWindow(lastDockWidget);
// the group window could still have placeholder items => clear everything
layoutInfo()->deleteAllLayoutItems();
layoutInfo()->item_list.clear();
// remove the group window and the dock's item_list pointing to it.