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

Unified Diff: webrtc/pc/peerconnection.cc

Issue 2882803002: Initialize PeerConnection members in declaration order and destroy them in reverse order. (Closed)
Patch Set: Created 3 years, 7 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 | « webrtc/pc/peerconnection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnection.cc
diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc
index 65203fdc731f1ef8e861e3971800d811fa2c61cc..852dd39de5bc21eed1461340f796d4ef0132e55f 100644
--- a/webrtc/pc/peerconnection.cc
+++ b/webrtc/pc/peerconnection.cc
@@ -395,10 +395,10 @@ PeerConnection::PeerConnection(PeerConnectionFactory* factory)
: factory_(factory),
observer_(NULL),
uma_observer_(NULL),
+ event_log_(RtcEventLog::Create()),
signaling_state_(kStable),
ice_connection_state_(kIceConnectionNew),
ice_gathering_state_(kIceGatheringNew),
- event_log_(RtcEventLog::Create()),
rtcp_cname_(GenerateRtcpCname()),
local_streams_(StreamCollection::Create()),
remote_streams_(StreamCollection::Create()) {}
@@ -1289,7 +1289,6 @@ void PeerConnection::Close() {
stats_->UpdateStats(kStatsOutputLevelStandard);
session_->Close();
- event_log_.reset();
network_thread()->Invoke<void>(
RTC_FROM_HERE,
rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool,
@@ -1297,6 +1296,9 @@ void PeerConnection::Close() {
factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE,
[this] { call_.reset(); });
+
+ // The event log must outlive call (and any other object that uses it).
+ event_log_.reset();
}
void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,
« no previous file with comments | « webrtc/pc/peerconnection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698