Index: remoting/host/chromoting_host.cc |
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc |
index 8bc93449ad74bce26b534acbc70679a2b7ddb4d7..d2c0232e7144616804cedf2bbbf000774462787d 100644 |
--- a/remoting/host/chromoting_host.cc |
+++ b/remoting/host/chromoting_host.cc |
@@ -178,11 +178,10 @@ |
// Disconnect all other clients. |it| should be advanced before Disconnect() |
// is called to avoid it becoming invalid when the client is removed from |
// the list. |
- ClientSessions::iterator it = clients_.begin(); |
+ ClientList::iterator it = clients_.begin(); |
base::WeakPtr<ChromotingHost> self = weak_factory_.GetWeakPtr(); |
while (it != clients_.end()) { |
- ClientSession* other_client = it->get(); |
- ++it; |
+ ClientSession* other_client = *it++; |
if (other_client != client) { |
other_client->DisconnectSession(protocol::OK); |
@@ -221,16 +220,13 @@ |
void ChromotingHost::OnSessionClosed(ClientSession* client) { |
DCHECK(CalledOnValidThread()); |
- ClientSessions::iterator it = |
- std::find_if(clients_.begin(), clients_.end(), |
- [client](const std::unique_ptr<ClientSession>& item) { |
- return item.get() == client; |
- }); |
+ ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); |
CHECK(it != clients_.end()); |
bool was_authenticated = client->is_authenticated(); |
std::string jid = client->client_jid(); |
clients_.erase(it); |
+ delete client; |
if (was_authenticated) { |
FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
@@ -280,9 +276,11 @@ |
} |
// Create a ClientSession object. |
- clients_.push_back(base::MakeUnique<ClientSession>( |
+ ClientSession* client = new ClientSession( |
this, std::move(connection), desktop_environment_factory_, |
- max_session_duration_, pairing_registry_, extensions_.get())); |
+ max_session_duration_, pairing_registry_, extensions_.get()); |
+ |
+ clients_.push_back(client); |
} |
void ChromotingHost::DisconnectAllClients() { |