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

Side by Side Diff: webrtc/api/peerconnection.cc

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)
Patch Set: DCHECK in destructor added Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/rtcstats_integrationtest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // Need to detach RTP senders/receivers from WebRtcSession, 601 // Need to detach RTP senders/receivers from WebRtcSession,
602 // since it's about to be destroyed. 602 // since it's about to be destroyed.
603 for (const auto& sender : senders_) { 603 for (const auto& sender : senders_) {
604 sender->internal()->Stop(); 604 sender->internal()->Stop();
605 } 605 }
606 for (const auto& receiver : receivers_) { 606 for (const auto& receiver : receivers_) {
607 receiver->internal()->Stop(); 607 receiver->internal()->Stop();
608 } 608 }
609 // Destroy stats_ because it depends on session_. 609 // Destroy stats_ because it depends on session_.
610 stats_.reset(nullptr); 610 stats_.reset(nullptr);
611 if (stats_collector_) {
612 stats_collector_->WaitForPendingRequest();
613 stats_collector_ = nullptr;
614 }
611 // Now destroy session_ before destroying other members, 615 // Now destroy session_ before destroying other members,
612 // because its destruction fires signals (such as VoiceChannelDestroyed) 616 // because its destruction fires signals (such as VoiceChannelDestroyed)
613 // which will trigger some final actions in PeerConnection... 617 // which will trigger some final actions in PeerConnection...
614 session_.reset(nullptr); 618 session_.reset(nullptr);
615 // port_allocator_ lives on the network thread and should be destroyed there. 619 // port_allocator_ lives on the network thread and should be destroyed there.
616 network_thread()->Invoke<void>(RTC_FROM_HERE, 620 network_thread()->Invoke<void>(RTC_FROM_HERE,
617 [this] { port_allocator_.reset(nullptr); }); 621 [this] { port_allocator_.reset(nullptr); });
618 } 622 }
619 623
620 bool PeerConnection::Initialize( 624 bool PeerConnection::Initialize(
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 2404
2401 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2405 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2402 int64_t max_size_bytes) { 2406 int64_t max_size_bytes) {
2403 return event_log_->StartLogging(file, max_size_bytes); 2407 return event_log_->StartLogging(file, max_size_bytes);
2404 } 2408 }
2405 2409
2406 void PeerConnection::StopRtcEventLog_w() { 2410 void PeerConnection::StopRtcEventLog_w() {
2407 event_log_->StopLogging(); 2411 event_log_->StopLogging();
2408 } 2412 }
2409 } // namespace webrtc 2413 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/rtcstats_integrationtest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698