Network chat: when removing an entry in multihash, specify which one
Using only the key means all clients with that IP address are removed. But there could be multiple clients running on the same multi-user system. So, use the value as well to remove just the specific one. This also fixes a bug where, when a client disconnects, all of the connections are removed from the client's map, but only _one_ is removed from the GUI. Task-number: QTBUG-108873 Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
This commit is contained in:
parent
6eac22e2ca
commit
804b26b77d
@ -94,7 +94,7 @@ void Client::connectionError(QAbstractSocket::SocketError /* socketError */)
|
||||
|
||||
void Client::removeConnection(Connection *connection)
|
||||
{
|
||||
if (peers.remove(connection->peerAddress()) > 0) {
|
||||
if (peers.remove(connection->peerAddress(), connection) > 0) {
|
||||
QString nick = connection->name();
|
||||
if (!nick.isEmpty())
|
||||
emit participantLeft(nick);
|
||||
|
Loading…
x
Reference in New Issue
Block a user