From de92efd44812640aefa4f02fb8d9f8f6d04de688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 9 Mar 2015 17:39:35 +0100 Subject: 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 --- src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm index bd0f89ba2f..13b7dc4358 100644 --- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm @@ -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 -- cgit v1.2.3