aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicklayouts
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2023-03-10 13:52:42 +0100
committerJan Arve Sæther <jan-arve.saether@qt.io>2023-03-23 19:33:25 +0100
commit24f5695d35f0ef7a8f48502de3d4810d21fb3d3f (patch)
tree852a32bf790e8fc3067120cc5efb1a730731342a /src/quicklayouts
parente9c0b15060e0b70f70857d02029d6ebed95c0abf (diff)
Do not crash if resizing a layout that got its child destroyed
Normally updatePolish() would call ensureLayoutItemsUpdated(), but in some cases the layout might be resized before the updatePolish() is processed. We therefore have to also call ensureLayoutItemsUpdated() from rearrange() Fixes: QTBUG-111792 Change-Id: Iab24dafc26dfa86975348c92244034f7ff825e5f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/quicklayouts')
-rw-r--r--src/quicklayouts/qquicklinearlayout.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quicklayouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp
index c7beb6045e..b4d94dfae2 100644
--- a/src/quicklayouts/qquicklinearlayout.cpp
+++ b/src/quicklayouts/qquicklinearlayout.cpp
@@ -459,6 +459,10 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size)
return;
}
+ // Should normally not be needed, but there might be an incoming window resize event that we
+ // will process before we process updatePolish()
+ ensureLayoutItemsUpdated(QQuickLayout::ApplySizeHints | QQuickLayout::Recursive);
+
d->m_rearranging = true;
qCDebug(lcQuickLayouts) << objectName() << "QQuickGridLayoutBase::rearrange()" << size;
Qt::LayoutDirection visualDir = effectiveLayoutDirection();