diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-16 11:39:13 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-16 11:45:26 (GMT) |
commit | b7b567401c42343aed9abac7328472d6ffb37af0 (patch) | |
tree | 92a88b8024d615145b85b1df31ac360618d13405 | |
parent | d215ecd857be9eedee03703153ef2509c01b4811 (diff) | |
download | Qt-b7b567401c42343aed9abac7328472d6ffb37af0.zip Qt-b7b567401c42343aed9abac7328472d6ffb37af0.tar.gz Qt-b7b567401c42343aed9abac7328472d6ffb37af0.tar.bz2 |
Don't sendPostedEvents() twice when calling processEvents() manually
Commit fe0f807e1f4e7510c6d8cddd848bcbc25e358651 could cause
sendPostedEvents() to be called twice, which caused regressions in
tests/auto/qtimer. Fix this by only calling sendPostedEvents()
"manually" if we didn't see a WM_QT_SENDPOSTEDEVENTS message.
Reviewed-by: Prasanth Ullattil
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 0518e24..b3497b9 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -675,11 +675,6 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) bool seenWM_QT_SENDPOSTEDEVENTS = false; bool needWM_QT_SENDPOSTEDEVENTS = false; do { - if (! (flags & QEventLoop::EventLoopExec)) { - // when called "manually", always send posted events - QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); - } - DWORD waitRet = 0; HANDLE pHandles[MAXIMUM_WAIT_OBJECTS - 1]; QVarLengthArray<MSG> processedTimers; @@ -730,7 +725,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } } if (haveMessage) { - if (msg.message == WM_QT_SENDPOSTEDEVENTS && !(flags & QEventLoop::EventLoopExec)) { + if (msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { needWM_QT_SENDPOSTEDEVENTS = true; continue; @@ -785,6 +780,11 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } } while (canWait); + if (!seenWM_QT_SENDPOSTEDEVENTS && (flags & QEventLoop::EventLoopExec) == 0) { + // when called "manually", always send posted events + QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); + } + if (needWM_QT_SENDPOSTEDEVENTS) PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); |