aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Arve Sæther <Jan-Arve.Saether@qt.io>2021-06-11 16:31:30 +0200
committerJan Arve Sæther <Jan-Arve.Saether@qt.io>2021-06-16 16:29:02 +0200
commit6dc95399797de4ec27984956df1fa587f4eb18ba (patch)
treebdc6870c716f301a1da78fa5224dddc2232eea3e /src
parent41766ac6d6e100b69d74c98edde60f0835b7da13 (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*). Pick-to: 5.15 6.2 Task-number: QTBUG-87708 Change-Id: I9403952e776afb2be37d009642c65b5520c79341 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-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 00cab471..bf309389 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;