import from UXP: [webrtc] Hold a self-ref on behalf of sigslot, just in case. (b73e47ce)

This commit is contained in:
2026-04-24 10:16:04 +08:00
parent 7614fe3db4
commit 78080634a0
@@ -3471,7 +3471,15 @@ static bool isFailed(PCImplIceConnectionState state) {
void PeerConnectionImpl::IceConnectionStateChange(
NrIceCtx* ctx,
NrIceCtx::ConnectionState state) {
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread");
// Let connection be the RTCPeerConnection object associated with this ICE
// Agent.
RefPtr<PeerConnectionImpl> connection(this);
if (IsClosed()) {
return;
}
CSFLogDebug(logTag, "%s", __FUNCTION__);
@@ -3569,7 +3577,12 @@ PeerConnectionImpl::IceGatheringStateChange(
NrIceCtx* ctx,
NrIceCtx::GatheringState state)
{
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread");
RefPtr<PeerConnectionImpl> kungFuDeathGrip(this);
if (IsClosed()) {
return;
}
CSFLogDebug(logTag, "%s", __FUNCTION__);