From 6d88cb7e7196a266f0e33b364cd6580516e47402 Mon Sep 17 00:00:00 2001 From: tangjie02 Date: Mon, 11 Jul 2022 20:41:53 +0800 Subject: [PATCH 1/2] fix(coredump): Fix the coredump as failed to connect pulaseaudio service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复失败连接pulseaudio服务时导致的崩溃问题 Signed-off-by: tangjie02 --- plugins/audio/pulse/pulse-context.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/audio/pulse/pulse-context.cpp b/plugins/audio/pulse/pulse-context.cpp index e32e02d..699b7c6 100644 --- a/plugins/audio/pulse/pulse-context.cpp +++ b/plugins/audio/pulse/pulse-context.cpp @@ -83,8 +83,12 @@ bool PulseContext::connect(bool wait_for_daemon) } else { - pa_context_unref(this->context_); - this->context_ = NULL; + // on_pulse_state_cb回调函数可能已经进行了释放操作,所以这里需要进一步判断 + if (this->context_) + { + pa_context_unref(this->context_); + this->context_ = NULL; + } return false; } } @@ -787,4 +791,4 @@ std::string PulseContext::get_default_app_name() return PROJECT_NAME; } -} // namespace Kiran \ No newline at end of file +} // namespace Kiran -- 2.33.0