summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9b4a4bdc124..d41e80fad00 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2472,8 +2472,10 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
}
if (propagate) {
- for (int i = 0; i < children.size(); ++i) {
- QWidget *c = qobject_cast<QWidget*>(children.at(i));
+ // We copy the list because the order may be modified
+ const QObjectList childrenList = children;
+ for (int i = 0; i < childrenList.size(); ++i) {
+ QWidget *c = qobject_cast<QWidget*>(childrenList.at(i));
if (c)
c->d_func()->inheritStyle();
}