Index: webrtc/api/peerconnection.cc |
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc |
index ebce40ca5eb0cf37d03243663826ea911eda06c3..58174f08c11bbd10d36e58c3420a3d06ff8b909e 100644 |
--- a/webrtc/api/peerconnection.cc |
+++ b/webrtc/api/peerconnection.cc |
@@ -608,6 +608,10 @@ PeerConnection::~PeerConnection() { |
} |
// Destroy stats_ because it depends on session_. |
stats_.reset(nullptr); |
+ if (stats_collector_) { |
+ stats_collector_->WaitForPendingRequest(); |
+ stats_collector_ = nullptr; |
+ } |
// Now destroy session_ before destroying other members, |
// because its destruction fires signals (such as VoiceChannelDestroyed) |
// which will trigger some final actions in PeerConnection... |