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}
diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h
index 66b7d3f..075a907 100644
--- a/pc/test/integration_test_helpers.h
+++ b/pc/test/integration_test_helpers.h
@@ -1355,10 +1355,12 @@
// when Send() is called it will hit a seg fault.
if (caller_) {
caller_->set_signaling_message_receiver(nullptr);
+ caller_->pc()->Close();
delete SetCallerPcWrapperAndReturnCurrent(nullptr);
}
if (callee_) {
callee_->set_signaling_message_receiver(nullptr);
+ callee_->pc()->Close();
delete SetCalleePcWrapperAndReturnCurrent(nullptr);
}
@@ -1779,8 +1781,10 @@
}
void ClosePeerConnections() {
- caller()->pc()->Close();
- callee()->pc()->Close();
+ if (caller())
+ caller()->pc()->Close();
+ if (callee())
+ callee()->pc()->Close();
}
void TestNegotiatedCipherSuite(