Remove ConnectionInfo after socket is destroyed

This leaves the ConnectionInfo in a valid state, even after the socket is disconnected, which could still have a readyRead() signal emitted.

Closes #123
This commit is contained in:
dail8859 2020-12-22 20:49:50 -05:00
parent 451a42d8f9
commit 99cd51d5a2

View File

@ -328,10 +328,12 @@ void SingleApplicationPrivate::slotConnectionEstablished()
} }
); );
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
[nextConnSocket, this](){
QObject::connect(nextConnSocket, &QLocalSocket::destroyed,
[nextConnSocket, this](QObject *obj){
Q_UNUSED(obj)
connectionMap.remove(nextConnSocket); connectionMap.remove(nextConnSocket);
nextConnSocket->deleteLater();
} }
); );