Invalidate weak pointers in SdpOfferAnswerHandler::Close().
This stops pending internal callbacks from performing unnecessary operations when closed. Also update tests pc tests to call Close(). This will allow PeerConnection to be able to expect the normal path to be that IsClosed() be true in the dtor once all 'normal' paths do that Bug: webrtc:12633 Change-Id: I3882bedf200feda0d04594adeb0fdac85bfef652 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213426 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33617}
This commit is contained in:
committed by
Commit Bot
parent
0f030fd263
commit
2efb8a5ec6
@ -683,7 +683,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
// Use fake audio capture module since we're only testing the interface
|
||||
// level, and using a real one could make tests flaky when run in parallel.
|
||||
fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
|
||||
@ -701,6 +701,11 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
|
||||
PeerConnectionFactoryForTest::CreatePeerConnectionFactoryForTest();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
if (pc_)
|
||||
pc_->Close();
|
||||
}
|
||||
|
||||
void CreatePeerConnection() {
|
||||
CreatePeerConnection(PeerConnectionInterface::RTCConfiguration());
|
||||
}
|
||||
@ -734,6 +739,10 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
void CreatePeerConnection(const RTCConfiguration& config) {
|
||||
if (pc_) {
|
||||
pc_->Close();
|
||||
pc_ = nullptr;
|
||||
}
|
||||
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
|
||||
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
|
||||
port_allocator_ = port_allocator.get();
|
||||
|
||||
Reference in New Issue
Block a user