Commit 7e72a5e1 authored by Oliver Wolff's avatar Oliver Wolff Committed by Maurice Kalinowski
Browse files

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: default avatarMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Showing with 5 additions and 5 deletions
...@@ -210,8 +210,10 @@ bool QEventDispatcherWinRT::processEvents(QEventLoop::ProcessEventsFlags flags) ...@@ -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) ...@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment