diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-07-04 14:45:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-05 13:37:22 +0200 |
commit | 3f605c8b45634c3fae06610b1102cbeae2382bec (patch) | |
tree | 2adbbbbef17501243b4afc35b87a63c070a25b74 /src/corelib/io/qwinoverlappedionotifier.cpp | |
parent | a4478b28966c5f630ba3d93b97bc91a3cec2fdbe (diff) |
bail out early in QWinOverlappedIoNotifier::waitForNotified
Calling waitForNotified on an uninitialized notifier will print a
warning and return false. The autotest has been adjusted.
Change-Id: I85e18d6d0a8a5462e1a5d451613add941d89b5fb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib/io/qwinoverlappedionotifier.cpp')
-rw-r--r-- | src/corelib/io/qwinoverlappedionotifier.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qwinoverlappedionotifier.cpp b/src/corelib/io/qwinoverlappedionotifier.cpp index 8f4b8be9a3..7ba862c602 100644 --- a/src/corelib/io/qwinoverlappedionotifier.cpp +++ b/src/corelib/io/qwinoverlappedionotifier.cpp @@ -122,6 +122,8 @@ public: mutex.unlock(); } + using QThread::isRunning; + protected: void run() { @@ -216,6 +218,11 @@ void QWinOverlappedIoNotifier::setEnabled(bool enabled) */ bool QWinOverlappedIoNotifier::waitForNotified(int msecs, OVERLAPPED *overlapped) { + if (!iocp->isRunning()) { + qWarning("Called QWinOverlappedIoNotifier::waitForNotified on inactive notifier."); + return false; + } + forever { DWORD result = WaitForSingleObject(hSemaphore, msecs == -1 ? INFINITE : DWORD(msecs)); if (result == WAIT_OBJECT_0) { |