From 3722bc5d3cd1b246f1480ea969a8d9cd5e41b1ee Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 6 Feb 2012 16:13:45 +0100 Subject: 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 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- cgit v1.2.3