diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-11-09 14:53:37 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-11-11 17:21:22 (GMT) |
commit | 40afbefbfe11e5cfccd5fb53717bc9c6990956c5 (patch) | |
tree | ac3fb7e192a92850189e20a63383f1e8420e4718 /src | |
parent | 80b476b07ee01ed658cbe7ceb4461eee1ec22e96 (diff) | |
download | Qt-40afbefbfe11e5cfccd5fb53717bc9c6990956c5.zip Qt-40afbefbfe11e5cfccd5fb53717bc9c6990956c5.tar.gz Qt-40afbefbfe11e5cfccd5fb53717bc9c6990956c5.tar.bz2 |
Add error handling for SetTimer() with the sentinel timer id
If SetTimer() fails when trying to delay sendPostedEvents(), emit a
warning and try to continue.
Reviewed-by: mauricek
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index f2e66c5..3050b82 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -70,7 +70,8 @@ extern uint qGlobalPostedEventsCount(); enum { WM_QT_SOCKETNOTIFIER = WM_USER, - WM_QT_SENDPOSTEDEVENTS = WM_USER + 1 + WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, + SendPostedEventsTimerId = ~1u }; #if defined(Q_OS_WINCE) @@ -470,7 +471,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == ~1u) { + if (wp == SendPostedEventsTimerId) { KillTimer(d->internalHwnd, wp); int localSerialNumber = d->serialNumber; (void) d->wakeUps.fetchAndStoreRelease(0); @@ -488,7 +489,14 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { // delay the next pass of sendPostedEvents() until we get the special // WM_TIMER, which allows all pending Windows messages to be processed - SetTimer(d->internalHwnd, ~1u, 0, 0); + if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) { + // failed to start the timer, oops, clear wakeUps in an attempt to keep things running + qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer"); + d->wakeUps.fetchAndStoreRelease(0); + } else { + // SetTimer() succeeded, nothing to do now + ; + } } else { // nothing pending in the queue, let sendPostedEvents go through d->wakeUps.fetchAndStoreRelease(0); |