QWindowsPipeReader: zero OVERLAPPED struct before every ReadFile

According to the documentation we should always pass a zeroed
OVERLAPPED object to ReadFile.

Change-Id: I3f822af46a2c38e029e02461f706c4fd91c00c50
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
bb10
Joerg Bornemann 2015-04-16 14:13:44 +02:00
parent 6cea45cc24
commit 5fc52ba6e2
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,6 @@ void QWindowsPipeReader::setHandle(HANDLE hPipeReadEnd)
readBuffer.clear();
actualReadBufferSize = 0;
handle = hPipeReadEnd;
ZeroMemory(&overlapped, sizeof(overlapped));
pipeBroken = false;
readyReadEmitted = false;
if (hPipeReadEnd != INVALID_HANDLE_VALUE) {
@ -206,6 +205,7 @@ void QWindowsPipeReader::startAsyncRead()
char *ptr = readBuffer.reserve(bytesToRead);
readSequenceStarted = true;
ZeroMemory(&overlapped, sizeof(overlapped));
if (ReadFile(handle, ptr, bytesToRead, NULL, &overlapped)) {
// We get notified by the QWinOverlappedIoNotifier - even in the synchronous case.
return;