diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-02-14 12:29:14 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-02-14 15:05:35 (GMT) |
commit | 220efa578b7d032257c7fa95aaf1295330fd474e (patch) | |
tree | c5c19c64142d8fea333ac1407bbd36cd8b910e02 /src/corelib/kernel | |
parent | f7e75244ab62b1fe0d1d73b84a6089d6b2a81d1a (diff) | |
download | Qt-220efa578b7d032257c7fa95aaf1295330fd474e.zip Qt-220efa578b7d032257c7fa95aaf1295330fd474e.tar.gz Qt-220efa578b7d032257c7fa95aaf1295330fd474e.tar.bz2 |
Keep sending posted events after commit 7196045b78b33cf135683d5c0b4e164f95231791
This commit put in place a timer based mechanism to ensure that posted
events continue to be sent. As pointed out in commit
eb1015c7bbf135af3656110a4d112377c1209db8, GetQueueStatus() can indicate
that there are messages in the queue but our hook never actually
receives them, hence the timer solution.
However, having the message type and hwnd "guards" in the conditional
for starting a timer would cause us to lose events in some situations,
due to the fact that QEventDispatcherWin32::processEvents() will only
allow one WM_QT_SENDPOSTEDEVENTS message per call (multiple messages
will be compressed into a single one). When racing with other threads,
it would be possible to end up blocking one thread that has pending
posted events unintentionally.
This fix removes the guards and makes sure that we start the keep alive
timer when it's really needed, and only stops it when we really know
that there is nothing left in the Windows message queue.
Task-number: QTBUG-17014
Reviewed-by: joao
Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index bba563a..6d90a51 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -530,10 +530,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); } } else if (d->sendPostedEventsWindowsTimerId == 0 - && localSerialNumber != d->lastSerialNumber - // if this message IS the one that triggers sendPostedEvents(), no need to post it again - && (msg->hwnd != d->internalHwnd - || msg->message != WM_QT_SENDPOSTEDEVENTS)) { + && localSerialNumber != d->lastSerialNumber) { // start a special timer to continue delivering posted events while // there are still input and timer messages in the message queue d->sendPostedEventsWindowsTimerId = SetTimer(d->internalHwnd, |