From 804b26b77d61310f20245360fcc2e3bd9daaf59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 23 May 2023 12:33:12 +0200 Subject: [PATCH] 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 Reviewed-by: Konrad Kujawa --- examples/network/network-chat/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index 8d33a016423..383ae402766 100644 --- a/examples/network/network-chat/client.cpp +++ b/examples/network/network-chat/client.cpp @@ -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);