QLocalSocket: do not emit aboutToClose() twice

This signal is emitted by the QIODevice itself, so we don't have to
forward it from the internal socket.

Pick-to: 6.1 6.2
Change-Id: I85745f36d7a27d92f339a9184de3b6e5d46f6f34
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Alex Trotsenko 2021-07-31 15:20:54 +03:00
parent 6e3897b9fa
commit 21f3ff65b8
3 changed files with 3 additions and 2 deletions

View File

@ -68,7 +68,6 @@ void QLocalSocketPrivate::setSocket(QLocalUnixSocket* socket)
Q_Q(QLocalSocket);
// QIODevice signals
q->connect(tcpSocket, SIGNAL(aboutToClose()), q, SIGNAL(aboutToClose()));
q->connect(tcpSocket, SIGNAL(bytesWritten(qint64)),
q, SIGNAL(bytesWritten(qint64)));
q->connect(tcpSocket, SIGNAL(readyRead()), q, SIGNAL(readyRead()));

View File

@ -97,7 +97,6 @@ void QLocalSocketPrivate::init()
{
Q_Q(QLocalSocket);
// QIODevice signals
q->connect(&unixSocket, SIGNAL(aboutToClose()), q, SIGNAL(aboutToClose()));
q->connect(&unixSocket, SIGNAL(bytesWritten(qint64)),
q, SIGNAL(bytesWritten(qint64)));
q->connect(&unixSocket, SIGNAL(readyRead()), q, SIGNAL(readyRead()));

View File

@ -489,6 +489,7 @@ void tst_QLocalSocket::connectWithOpen()
QVERIFY(server.listen("tst_qlocalsocket"));
LocalSocket socket;
QSignalSpy spyAboutToClose(&socket, SIGNAL(aboutToClose()));
socket.setServerName("tst_qlocalsocket");
QVERIFY(socket.open());
@ -502,6 +503,8 @@ void tst_QLocalSocket::connectWithOpen()
socket.close();
server.close();
QCOMPARE(spyAboutToClose.count(), 1);
}
void tst_QLocalSocket::listenAndConnectAbstractNamespaceTrailingZeros_data()