diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-02-06 16:13:45 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-07 12:47:25 +0100 |
commit | 3722bc5d3cd1b246f1480ea969a8d9cd5e41b1ee (patch) | |
tree | 3f7e91b867f1934125b86e310dcd7b04fcd7066a /src/plugins/platforms/cocoa | |
parent | 36f5cc848de25251bfb1cae2ddeea0871ded1fac (diff) |
Ensure that posted events are sent by Q*Application::processEvents()
Commit b7ca6a81dbf6a2b96c8f04b856372050618e60c0 removed a call to
sendPostedEvents() that deemed unnecessary. Unfortunately, it is
necessary, as shown by the
tst_QScriptEngine::processEventsWhileRunning() test in the QtScript
module. Re-add the call, but only when not waiting for more events.
Change-Id: I648d66dd3ba484ad9e9a93fc03a9792cca5035c6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 6de22cf58c..305a8ddc95 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -569,6 +569,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) } retVal = true; } else { + int lastSerialCopy = d->lastSerial; bool hadModalSession = d->currentModalSessionCached != 0; // We cannot block the thread (and run in a tight loop). // Instead we will process all current pending events and return. @@ -631,6 +632,14 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) } } while (!d->interrupt && event != nil); + if ((flags & QEventLoop::WaitForMoreEvents) == 0) { + // when called "manually", always send posted events + d->processPostedEvents(); + } + + // be sure to return true if the posted event source fired + retVal = retVal || lastSerialCopy != d->lastSerial; + // Since the window that holds modality might have changed while processing // events, we we need to interrupt when we return back the previous process // event recursion to ensure that we spin the correct modal session. |