diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2023-05-23 12:33:12 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2023-05-31 12:55:58 +0200 |
commit | 804b26b77d61310f20245360fcc2e3bd9daaf59d (patch) | |
tree | 2fbbc926ba5ae5f1d8f18e30357042555112a66e | |
parent | 6eac22e2cabc51ce3b0ef0eda38b6c50bb343f7c (diff) |
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>
-rw-r--r-- | examples/network/network-chat/client.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index 8d33a01642..383ae40276 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); |