QMdiArea: port Q_FOREACH to ranged-for, d->pendingPlacements

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: Ibf2f049aacad925fea318c0ec490749e68e05b1d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Ahmad Samir 2023-08-09 16:38:55 +03:00
parent cfec14e1ff
commit 446af298b0
1 changed files with 6 additions and 1 deletions

View File

@ -2345,7 +2345,12 @@ void QMdiArea::showEvent(QShowEvent *showEvent)
}
if (!d->pendingPlacements.isEmpty()) {
foreach (QMdiSubWindow *window, d->pendingPlacements) {
// Nothing obvious in the loop body changes the container (in this code path)
// during iteration, this is calling into a non-const method that does change
// the container when called from other places. So take a copy anyway for good
// measure.
const auto copy = d->pendingPlacements;
for (QMdiSubWindow *window : copy) {
if (!window)
continue;
if (!window->testAttribute(Qt::WA_Resized)) {