From: Denis Dolzhenko Date: Mon, 12 Sep 2016 16:26:34 +0000 (+0300) Subject: TizenRefApp-7166 Crash during send message when DPM enable X-Git-Tag: submit/tizen/20160916.133943^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32d05ffdff97881b62af35a15ddf9324e16b9757;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-7166 Crash during send message when DPM enable Change-Id: I7ea01bb70f7755e89e04cfa72a0e599949875fde Signed-off-by: Denis Dolzhenko --- diff --git a/src/Common/MsgEngine/inc/MsgTypes.h b/src/Common/MsgEngine/inc/MsgTypes.h index 295bc81..5f84b16 100644 --- a/src/Common/MsgEngine/inc/MsgTypes.h +++ b/src/Common/MsgEngine/inc/MsgTypes.h @@ -25,8 +25,10 @@ namespace Msg { public: typedef unsigned Type; + static const Type invalidId = 0; + BaseMsgId() - : value(0) + : value(invalidId) { } diff --git a/src/Common/MsgEngine/src/private/MessagePrivate.cpp b/src/Common/MsgEngine/src/private/MessagePrivate.cpp index aa68e7c..5d791bd 100644 --- a/src/Common/MsgEngine/src/private/MessagePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MessagePrivate.cpp @@ -70,7 +70,7 @@ void MessagePrivate::addAddresses(const MsgAddressList &list) MsgId MessagePrivate::getId() const { - int id = -1; + int id = MsgId::invalidId; msg_get_int_value(m_MsgStruct, MSG_MESSAGE_ID_INT, &id); return id; } @@ -82,7 +82,7 @@ void MessagePrivate::setId(MsgId id) ThreadId MessagePrivate::getThreadId() const { - int threadId = -1; + int threadId = ThreadId::invalidId; msg_get_int_value(m_MsgStruct, MSG_MESSAGE_THREAD_ID_INT, &threadId); return threadId; } diff --git a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp index 16a0cd3..989f64c 100644 --- a/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp @@ -37,14 +37,14 @@ MsgConversationItemPrivate::~MsgConversationItemPrivate() MsgId MsgConversationItemPrivate::getMsgId() const { - int id = -1; + int id = MsgId::invalidId; msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_ID_INT, &id); return id; } ThreadId MsgConversationItemPrivate::getThreadId() const { - int id = -1; + int id = ThreadId::invalidId; msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_THREAD_ID_INT, &id); return id; } diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp index e522e93..9ba1447 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp @@ -122,7 +122,7 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList() ThreadId MsgStoragePrivate::getThreadId(const MsgAddressList &addressList) { - msg_thread_id_t id = -1; + msg_thread_id_t id = ThreadId::invalidId; if(const MsgAddressListHandlePrivate *privateList = dynamic_cast(&addressList)) { @@ -144,7 +144,7 @@ ThreadId MsgStoragePrivate::getThreadId(const MsgAddressList &addressList) ThreadId MsgStoragePrivate::getThreadId(const std::list &addressList) { - msg_thread_id_t tid = -1; + msg_thread_id_t tid = ThreadId::invalidId; msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); if(msgInfo) @@ -410,7 +410,7 @@ bool MsgStoragePrivate::isDeliverReportChecked(MsgId msgId) ThreadId MsgStoragePrivate::getThreadId(MsgId id) { - int threadId = -1; + int threadId = ThreadId::invalidId; msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); diff --git a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp index 1b18a97..afe3a4a 100644 --- a/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp @@ -38,7 +38,7 @@ MsgThreadItemPrivate::~MsgThreadItemPrivate() ThreadId MsgThreadItemPrivate::getId() const { - int id = -1; + int id = ThreadId::invalidId; msg_get_int_value(m_MsgStruct, MSG_THREAD_ID_INT, &id); return id; } diff --git a/src/MsgThread/Controller/src/BaseThreadListItem.cpp b/src/MsgThread/Controller/src/BaseThreadListItem.cpp index eec59b4..67e42cd 100644 --- a/src/MsgThread/Controller/src/BaseThreadListItem.cpp +++ b/src/MsgThread/Controller/src/BaseThreadListItem.cpp @@ -56,6 +56,12 @@ void BaseThreadListItem::updateThumbnailAndName(const MsgThreadItem &threadItem, void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressList, bool decorateName) { int countContact = addressList.getLength(); + if(countContact <= 0) + { + MSG_LOG_WARN("Msg address list is empty"); + return; + } + const MsgAddress &addr = addressList[0]; if(countContact > 1) @@ -68,10 +74,6 @@ void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressLis m_ThumbId = m_App.getThumbnailMaker().getThumbId(addr); updateName(addr, countContact, decorateName); } - else - { - MSG_LOG_WARN("Msg address list is empty"); - } } void BaseThreadListItem::updateName(const MsgAddress &address, int addressesCount, bool decorateName)