From 94774d475b5264e697e3bbc38bda55ceecde1bc7 Mon Sep 17 00:00:00 2001 From: Tommi Date: Mon, 24 Apr 2023 11:31:45 +0200 Subject: [PATCH] Call PrepareShutdown in the dtor just in case Close() hasn't been called Bug: b/277912909 Change-Id: I0074de59f5d16d500795589a0c94ff4840ffe57a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/302384 Reviewed-by: Florent Castelli Commit-Queue: Tomas Gunnarsson Cr-Commit-Position: refs/heads/main@{#39932} --- pc/peer_connection.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index d9602ea479..4839fcf0a1 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -543,6 +543,10 @@ PeerConnection::~PeerConnection() { sdp_handler_->PrepareForShutdown(); } + // In case `Close()` wasn't called, always make sure the controller cancels + // potentially pending operations. + data_channel_controller_.PrepareForShutdown(); + // Need to stop transceivers before destroying the stats collector because // AudioRtpSender has a reference to the LegacyStatsCollector it will update // when stopping.