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.9 6.8
Fixes: QTBUG-135950
Change-Id: Ie6d1f0f726b66ab6a8036f281b46e525084d90e8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-04-14 15:37:32 +02:00
parent 61be342d02
commit 2e6032188f

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());
}