CF event dispatcher: Decide if eventsProcessed before breaking out of loop
In the case of calling processEvents with WaitForMoreEvents and ending up processing a Qt timer, we explicitly interrupt the runloop, as CF doesn't normally treat handling timers as having handled a source. That way we can re-evaluate whether processEvents should return. But, we need to compute eventsProcessed before breaking out of the Q_FOREVER loop, otherwise processEvents will return false when waiting for events and processing a timer. Change-Id: Ie5f8905228cce1508b5b2e040cf1186820855191 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This commit is contained in:
parent
dfd6fc7bce
commit
de92efd448
@ -268,6 +268,10 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
|
||||
|
||||
qUnIndent(); qEventDispatcherDebug() << "result = " << qPrintableResult(result);
|
||||
|
||||
eventsProcessed |= (result == kCFRunLoopRunHandledSource
|
||||
|| m_processEvents.processedPostedEvents
|
||||
|| m_processEvents.processedTimers);
|
||||
|
||||
if (result == kCFRunLoopRunFinished) {
|
||||
// This should only happen at application shutdown, as the main runloop
|
||||
// will presumably always have sources registered.
|
||||
@ -302,10 +306,6 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
|
||||
}
|
||||
}
|
||||
|
||||
eventsProcessed |= (result == kCFRunLoopRunHandledSource
|
||||
|| m_processEvents.processedPostedEvents
|
||||
|| m_processEvents.processedTimers);
|
||||
|
||||
if (m_processEvents.flags & QEventLoop::EventLoopExec) {
|
||||
// We were called from QEventLoop's exec(), which blocks until the event
|
||||
// loop is asked to exit by calling processEvents repeatedly. Instead of
|
||||
|
Loading…
Reference in New Issue
Block a user