summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmdiarea.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-09 16:38:55 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-30 16:48:43 +0300
commit446af298b0c00a419ff8e373e6b2917fd2af44eb (patch)
tree3917c79c63a4f72e7a22e180ae5e28b0efa39fef /src/widgets/widgets/qmdiarea.cpp
parentcfec14e1ff94b05bdfe15294199964247dbac518 (diff)
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>
Diffstat (limited to 'src/widgets/widgets/qmdiarea.cpp')
-rw-r--r--src/widgets/widgets/qmdiarea.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index ad8b55ca71..dfd54d3d98 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -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)) {