From 4e695eece7e1de874f3f8bb0a530a2ae05a0014a Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 24 Aug 2021 18:30:12 +0300 Subject: 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 --- src/network/socket/qlocalsocket_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network') 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; } -- cgit v1.2.3