Don't stop QPlaformWindow updateRequest timer until after delivery

Delivery of the update request may be circumvented temporarily by the
platform window, or the user may request another update during the
delivery, so wait to stop the timer until we know we don't need it
anymore.

Pick-to: 6.8
Fixes: QTBUG-135950
Change-Id: Ie6d1f0f726b66ab6a8036f281b46e525084d90e8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 2e6032188fee4430afbea377350c55dde46bfb43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2025-04-14 15:37:32 +02:00 committed by Qt Cherry-pick Bot
parent 50ef11616d
commit 06cec0646c

View File

@ -469,8 +469,13 @@ bool QPlatformWindow::windowEvent(QEvent *event)
if (event->type() == QEvent::Timer) {
if (static_cast<QTimerEvent *>(event)->timerId() == d->updateTimer.timerId()) {
d->updateTimer.stop();
deliverUpdateRequest();
// Delivery of the update request may be circumvented temporarily by the
// platform window, or the user may request another update during the
// delivery, so wait to stop the timer until we know we don't need it
// anymore.
if (!hasPendingUpdateRequest())
d->updateTimer.stop();
return true;
}
}
@ -770,7 +775,8 @@ void QPlatformWindow::requestUpdate()
}
}
Q_ASSERT(!d->updateTimer.isActive());
// Start or restart the timer (in case we're called during update
// request delivery).
d->updateTimer.start(updateInterval, Qt::PreciseTimer, window());
}