diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2021-10-02 19:08:03 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2021-10-05 08:32:58 +0300 |
commit | 1bed4a256522fab123ffe9c42a5988f50ea0aa0b (patch) | |
tree | 14919b6e1b8eb0a10d511c006da51a1e330fd15b /src/network | |
parent | 2549a88ba2a48fa2bedce97dd71a2974c6f8840a (diff) |
QLocalSocket/Win: add missing check to waitForBytesWritten()
Calling pipeWriter->checkForWrite() can indirectly close the socket
even if the bytesWritten() signal has not been sent. So, we need to
make sure the handle is valid before checking pipe state in the
reader.
There is no harm in calling PeekNamedPipe() with an invalid handle,
but the wrong call should be avoided.
This patch amends b2c3b3e8fe0d8bdc88051d0120aaa8d5cf8acce0.
Change-Id: I5d2ecbbbe0af817aac68ad6f1173b0ed9b324e98
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 019829cc9c..b98dcb0dbc 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -582,7 +582,7 @@ bool QLocalSocket::waitForBytesWritten(int msecs) if (d->pipeWriter->checkForWrite()) return true; - if (poller.waitForClose) + if (poller.waitForClose && isValid()) d->pipeReader->checkPipeState(); d->pipeReader->checkForReadyRead(); |