Let QWindowsPipeWriter::write only warn about unexpected errors

Do not print a critical message when the pipe connection dropped as this
can happen with regular QLocalSocket usage as demonstrated in
qtremoteobjects.

Change-Id: If79915ce5d83b8cae5e090c04e893dafcb5a88a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Joerg Bornemann 2017-07-14 11:13:20 +02:00
parent 2e2fa2a283
commit 3becc8527e
1 changed files with 9 additions and 1 deletions

View File

@ -201,7 +201,15 @@ bool QWindowsPipeWriter::write(const QByteArray &ba)
writeSequenceStarted = false;
numberOfBytesToWrite = 0;
buffer.clear();
qErrnoWarning("QWindowsPipeWriter::write failed.");
const DWORD errorCode = GetLastError();
switch (errorCode) {
case ERROR_NO_DATA: // "The pipe is being closed."
// The other end has closed the pipe. This can happen in QLocalSocket. Do not warn.
break;
default:
qErrnoWarning(errorCode, "QWindowsPipeWriter::write failed.");
}
return false;
}