From 5eff5e8ba233482fe6ebc024ea8461165ca6f337 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Wed, 22 Aug 2018 17:30:33 -0700 Subject: [PATCH] Add null check to avoid sigsegv on shutdown During shutdown, it's possible that msg task is freed as part of shutdown before the objects that can send messages to msg task are freed, which can result in a sigsegv when messages are sent during this time. Change-Id: I8f9963de75b395ca6c9a3d484416c34682cd0821 CRs-fixed: 2300596 --- utils/MsgTask.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index eaead5cf..ad95a83e 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -74,10 +74,11 @@ void MsgTask::destroy() { } void MsgTask::sendMsg(const LocMsg* msg) const { - if (msg) { + if (msg && this) { msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); } else { - LOC_LOGE("%s: msg is NULL", __func__); + LOC_LOGE("%s: msg is %p and this is %p", + __func__, msg, this); } }