summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-07-12 17:36:39 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-07-14 20:48:54 +0300
commit6c1bc7798bec6bc48439b297e55d14a9da0a3673 (patch)
tree5306df8fe590c75c44a3344c5ce624f89d7eedcf /src/network/socket
parentde58fa3038da8457490bcb2f160701f3bbb2d9be (diff)
QLocalSocket/Win: destroy the pipe before emitting final signals
Both readChannelFinished() and disconnected() signals should be emitted after closing the pipe. Otherwise, these signals do not correspond to the state of the socket and may even be resent, if a slot connected to one of these signals processes events. [ChangeLog][QtNetwork][Important Behavior Changes] QLocalSocket on Windows now emits both readChannelFinished() and disconnected() signals after closing the pipe and emitting stateChanged(UnconnectedState), which is consistent with the behavior on Unix. Pick-to: 6.2 Change-Id: I1cc551b7897fdba3cec1fd6705f5396790818c7d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qlocalsocket_win.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 34e0fe19f1..e8797ba4ab 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -336,22 +336,23 @@ void QLocalSocketPrivate::_q_pipeClosed()
if (state == QLocalSocket::UnconnectedState)
return;
- emit q->readChannelFinished();
if (state != QLocalSocket::ClosingState) {
state = QLocalSocket::ClosingState;
emit q->stateChanged(state);
if (state != QLocalSocket::ClosingState)
return;
}
- state = QLocalSocket::UnconnectedState;
- emit q->stateChanged(state);
- emit q->disconnected();
pipeReader->stop();
delete pipeWriter;
pipeWriter = nullptr;
destroyPipeHandles();
handle = INVALID_HANDLE_VALUE;
+
+ state = QLocalSocket::UnconnectedState;
+ emit q->stateChanged(state);
+ emit q->readChannelFinished();
+ emit q->disconnected();
}
qint64 QLocalSocket::bytesAvailable() const