From 48c27934c7e6727326c2298a2c4e0132d814c737 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 25 Oct 2023 18:30:38 +0200 Subject: [PATCH] [WebRTC] Give ::Terminated() the same treatment as ::Close_g --- .../signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index ad47e5316c..e99ab2d597 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -527,10 +527,16 @@ WebrtcGmpVideoEncoder::Terminated() { LOGD(("GMP Encoder Terminated: %p", (void *)this)); - mGMP->Close(); + GMPVideoEncoderProxy* gmp(mGMP); mGMP = nullptr; mHost = nullptr; mInitting = false; + + if (gmp) { + // Do this last, since this could cause us to be destroyed + gmp->Close(); + } + // Could now notify that it's dead }