winrt: process all triggered timers in processEvents
If only one timer is processed in there it is possible that a reoccuring timer which has a very low timeout blocks all the other timers from being triggered. This high frequency timer might be the only one to be triggered in every processEvents call. Task-number: QTBUG-51888 Change-Id: I8a0026d1e8519171ab60d1b47c494a15d30328b3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
This commit is contained in:
parent
9c3c350627
commit
7e72a5e11e
@ -210,8 +210,10 @@ bool QEventDispatcherWinRT::processEvents(QEventLoop::ProcessEventsFlags flags)
|
|||||||
const QVector<HANDLE> timerHandles = d->timerIdToHandle.values().toVector();
|
const QVector<HANDLE> timerHandles = d->timerIdToHandle.values().toVector();
|
||||||
if (waitTime)
|
if (waitTime)
|
||||||
emit aboutToBlock();
|
emit aboutToBlock();
|
||||||
|
bool timerEventsSent = false;
|
||||||
DWORD waitResult = WaitForMultipleObjectsEx(timerHandles.count(), timerHandles.constData(), FALSE, waitTime, TRUE);
|
DWORD waitResult = WaitForMultipleObjectsEx(timerHandles.count(), timerHandles.constData(), FALSE, waitTime, TRUE);
|
||||||
if (waitResult >= WAIT_OBJECT_0 && waitResult < WAIT_OBJECT_0 + timerHandles.count()) {
|
while (waitResult >= WAIT_OBJECT_0 && waitResult < WAIT_OBJECT_0 + timerHandles.count()) {
|
||||||
|
timerEventsSent = true;
|
||||||
const HANDLE handle = timerHandles.value(waitResult - WAIT_OBJECT_0);
|
const HANDLE handle = timerHandles.value(waitResult - WAIT_OBJECT_0);
|
||||||
ResetEvent(handle);
|
ResetEvent(handle);
|
||||||
const int timerId = d->timerHandleToId.value(handle);
|
const int timerId = d->timerHandleToId.value(handle);
|
||||||
@ -226,12 +228,10 @@ bool QEventDispatcherWinRT::processEvents(QEventLoop::ProcessEventsFlags flags)
|
|||||||
// Update timer's targetTime
|
// Update timer's targetTime
|
||||||
const quint64 targetTime = qt_msectime() + info.interval;
|
const quint64 targetTime = qt_msectime() + info.interval;
|
||||||
info.targetTime = targetTime;
|
info.targetTime = targetTime;
|
||||||
emit awake();
|
waitResult = WaitForMultipleObjectsEx(timerHandles.count(), timerHandles.constData(), FALSE, 0, TRUE);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
emit awake();
|
emit awake();
|
||||||
|
if (timerEventsSent || userEventsSent)
|
||||||
if (userEventsSent)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// We cannot wait infinitely like on other platforms, as
|
// We cannot wait infinitely like on other platforms, as
|
||||||
|
Loading…
x
Reference in New Issue
Block a user