Prevent re-replacing state in setGeometry

Do not allow replacing a state again if it is already being replaced.

Cleaned up from the patch provided in QTBUG-121126.

Fixes: QTBUG-121126
Pick-to: 6.6
Change-Id: Icca932b0e5cccd2f39ac18f29d8f7707887d147f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f429f12a7fb94ef5970a28eaf0b53aea935044b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tomi Korpipää 2024-02-27 10:21:12 +02:00 committed by Qt Cherry-pick Bot
parent 8b100d89f3
commit 2c743bc0cb

View File

@ -2230,7 +2230,9 @@ void QMainWindowLayout::applyRestoredState()
void QMainWindowLayout::setGeometry(const QRect &_r)
{
if (savedState.isValid())
// Check if the state is valid, and avoid replacing it again if it is currently used
// in applyState
if (savedState.isValid() || (restoredState && isInApplyState))
return;
QRect r = _r;