Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: net/quic/chromium/quic_stream_factory.cc

Issue 2344053003: Fixes crash bug when iterating through sessions in OnNetworkConnected. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_stream_factory.cc
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc
index 38d76d789e5efef2266350b414d10e020308d136..6831339a35bf9fcfee1ffd37a0f6828a3a862e84 100644
--- a/net/quic/chromium/quic_stream_factory.cc
+++ b/net/quic/chromium/quic_stream_factory.cc
@@ -1265,8 +1265,12 @@ void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) {
status_ = OPEN;
ScopedConnectionMigrationEventLog scoped_event_log(net_log_,
"OnNetworkConnected");
- for (auto session : all_sessions_) {
- session.first->OnNetworkConnected(network, scoped_event_log.net_log());
+ QuicStreamFactory::SessionIdMap::iterator it = all_sessions_.begin();
+ // Sessions may be deleted while iterating through the map.
+ while (it != all_sessions_.end()) {
+ QuicChromiumClientSession* session = it->first;
+ ++it;
+ session->OnNetworkConnected(network, scoped_event_log.net_log());
}
}
« no previous file with comments | « no previous file | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698