Skip to content

Commit

Permalink
Windows/MinGW: Fix posted events timer not stopping
Browse files Browse the repository at this point in the history
Specify the type of the enum value SendPostedEventsWindowsTimerId
to be UINT_PTR to work with the g++ interpretation of enumeration
signedness and use the correct type for the returned timer id.

Fixes: QTBUG-78491
Change-Id: I7b3f306d3f60da7a21500ece5243ac90854ccf1a
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
FriedemannKleint committed Sep 27, 2019
1 parent e7272ee commit d35de9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/corelib/kernel/qeventdispatcher_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
WM_QT_ACTIVATENOTIFIERS = WM_USER + 2,
SendPostedEventsWindowsTimerId = ~1u
};

enum : UINT_PTR {
SendPostedEventsWindowsTimerId = ~UINT_PTR(1)
};

class QEventDispatcherWin32Private;
Expand Down Expand Up @@ -278,7 +281,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
// no more input or timer events in the message queue, we can allow posted events to be sent normally now
if (d->sendPostedEventsWindowsTimerId != 0) {
// stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message
KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId);
KillTimer(d->internalHwnd, SendPostedEventsWindowsTimerId);
d->sendPostedEventsWindowsTimerId = 0;
}
(void) d->wakeUps.fetchAndStoreRelease(0);
Expand Down
3 changes: 2 additions & 1 deletion src/corelib/kernel/qeventdispatcher_win_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ class Q_CORE_EXPORT QEventDispatcherWin32Private : public QAbstractEventDispatch

// for controlling when to send posted events
QAtomicInt serialNumber;
int lastSerialNumber, sendPostedEventsWindowsTimerId;
int lastSerialNumber;
UINT_PTR sendPostedEventsWindowsTimerId;
QAtomicInt wakeUps;

// timers
Expand Down

0 comments on commit d35de9e

Please sign in to comment.