summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qlocalsocket_win.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-08-24 18:30:12 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-09-18 10:46:35 +0300
commit4e695eece7e1de874f3f8bb0a530a2ae05a0014a (patch)
treed7a92d2ace64ce126cdbd61149511bc81531b8b7 /src/network/socket/qlocalsocket_win.cpp
parent51e28dc54fab3caa9e2b3bea4fd7a2fb5724d7c7 (diff)
QWindowsPipeWriter: do not clear the buffer in thread pool callback
In a blocking application, receiving the results of write operations must be synchronized with the waitFor...() functions. But, clearing the buffer in another thread can cause the code localsocket.write(...); QVERIFY(localsocket.bytesToWrite() > 0); to fail unexpectedly, if the socket has been disconnected between the calls. So, defer resetting the buffer until checkForWrite() is called. Change-Id: I8c21036aab6a4c56d02c0d9a18d4bbce52d724f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/network/socket/qlocalsocket_win.cpp')
-rw-r--r--src/network/socket/qlocalsocket_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index e11c9e90be..c4da59c278 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -60,7 +60,7 @@ struct QSocketPoller
QSocketPoller::QSocketPoller(const QLocalSocketPrivate &socket)
{
- if (socket.pipeWriter && socket.pipeWriter->bytesToWrite() != 0) {
+ if (socket.pipeWriter && socket.pipeWriter->isWriteOperationActive()) {
handles[handleCount++] = socket.pipeWriter->syncEvent();
writePending = true;
}