diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2020-03-18 20:04:47 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-03 14:05:27 +0000 |
commit | e0d80167c18b5a71acf4dac59f3e6f37292fa397 (patch) | |
tree | bba098d08955d4d68b2bc98c1bd8ee3d6d7d4423 /src/corelib/kernel/qeventdispatcher_win_p.h | |
parent | 9834536cfaa903048c8ae510387606cd055658e6 (diff) |
QEventDispatcherWin32: fix posted events delivering
To avoid livelocks, posted events should be delivered when all pending
messages have been processed, and the thread's message queue becomes
empty. Although the logic of the previous patch is correct, it turned
out that determining the moment when the message queue is really empty
is not so simple. It is worth noting that the GetQueueStatus function
sometimes reports unexpected results due to internal filtering and
processing. Indeed, Windows docs say that "the return value from
GetQueueStatus should be considered only a hint as to whether
GetMessage or PeekMessage should be called". Thus, we cannot rely on
GetQueueStatus in unambiguous logic inside the qt_GetMessageHook.
To solve the problem, this patch introduces a guard timer which
guarantees low priority processing for posted events in foreign loop.
The wakeUps flag reset logic has also been changed to provide clearer
synchronization of the Qt internal loop.
Fixes: QTBUG-82701
Fixes: QTBUG-83151
Change-Id: I33d5001a40d2a4879ef4eb878c09bc1c0616e289
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win_p.h')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index e6620178d8..8f6f05e0a7 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -170,6 +170,7 @@ public: HHOOK getMessageHook; // for controlling when to send posted events + UINT_PTR sendPostedEventsTimerId; QAtomicInt wakeUps; // timers |