From 294f64cbac983a9119e14487b2cb5fb82faa7a63 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Fri, 2 Feb 2024 10:21:29 +0100 Subject: [PATCH] Fix crash in IceTransport::TimeoutCallback with libnice --- src/impl/icetransport.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/impl/icetransport.cpp b/src/impl/icetransport.cpp index 08fbbaaf2..269d16a3f 100644 --- a/src/impl/icetransport.cpp +++ b/src/impl/icetransport.cpp @@ -604,16 +604,14 @@ IceTransport::IceTransport(const Configuration &config, candidate_callback candi } IceTransport::~IceTransport() { - if (mTimeoutId) { - g_source_remove(mTimeoutId); - mTimeoutId = 0; - } - PLOG_DEBUG << "Destroying ICE transport"; nice_agent_attach_recv(mNiceAgent.get(), mStreamId, 1, g_main_loop_get_context(MainLoop.get()), NULL, NULL); nice_agent_remove_stream(mNiceAgent.get(), mStreamId); mNiceAgent.reset(); + + if (mTimeoutId) + g_source_remove(mTimeoutId); } Description::Role IceTransport::role() const { return mRole; }