aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJan Arve Sæther <Jan-Arve.Saether@qt.io>2021-06-11 16:31:30 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-16 15:25:43 +0000
commit25d042118a2284ae61ed3acc072a9b093b650a0b (patch)
treedfa21bd4a4389e1727e446f76a0f11ac2ff72315 /src/quicktemplates2
parente7b598072de53ccda1ea9caf6bb5a03401cfde33 (diff)
Add recursion guard to QQuickApplicationWindowPrivate::relayout()
relayout() might change the size of the header, footer or contentitem When one of those items changes, QQuickApplicationWindowPrivate will get notified by that through QQuickApplicationWindowPrivate::itemGeometryChanged(). itemGeometryChanged() will then call relayout()... (*recursed*). Task-number: QTBUG-87708 Change-Id: I9403952e776afb2be37d009642c65b5520c79341 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 6dc95399797de4ec27984956df1fa587f4eb18ba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 00cab47172..bf30938919 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -47,6 +47,7 @@
#include "qquickdeferredpointer_p_p.h"
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qscopedvaluerollback.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuick/private/qquickwindowmodule_p_p.h>
@@ -180,6 +181,7 @@ public:
QFont font;
QLocale locale;
QQuickItem *activeFocusControl = nullptr;
+ bool insideRelayout = false;
};
static void layoutItem(QQuickItem *item, qreal y, qreal width)
@@ -198,9 +200,10 @@ static void layoutItem(QQuickItem *item, qreal y, qreal width)
void QQuickApplicationWindowPrivate::relayout()
{
Q_Q(QQuickApplicationWindow);
- if (!complete)
+ if (!complete || insideRelayout)
return;
+ QScopedValueRollback<bool> guard(insideRelayout, true);
QQuickItem *content = q->contentItem();
qreal hh = header && header->isVisible() ? header->height() : 0;
qreal fh = footer && footer->isVisible() ? footer->height() : 0;