From d719260c89ebfca4431518f51051b21f94368c0c Mon Sep 17 00:00:00 2001 From: Evgen Servetnik Date: Thu, 31 Aug 2017 11:20:32 +0300 Subject: [PATCH] TizenRefApp-7788 Empty conversation displayed in thread list after deletion Change-Id: Ib8f2e7d295ff2e801b1f11aff813f528273463c6 Signed-off-by: Evgen Servetnik --- src/MsgThread/Controller/src/ThreadList.cpp | 8 ++++---- src/MsgThread/Controller/src/ThreadListItem.cpp | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/MsgThread/Controller/src/ThreadList.cpp b/src/MsgThread/Controller/src/ThreadList.cpp index 82201a80..022efea6 100644 --- a/src/MsgThread/Controller/src/ThreadList.cpp +++ b/src/MsgThread/Controller/src/ThreadList.cpp @@ -168,7 +168,7 @@ int ThreadList::cmpFunc(const ListItem &item1, const ListItem &item2) void ThreadList::insertItem(ThreadId id) { MsgThreadItemRef threadItem = m_App.getMsgEngine().getStorage().getThread(id); - if (threadItem) { + if (threadItem && threadItem->getId().isValid()) { auto newItem = new ThreadListItem(*threadItem, m_App); ListView::sortedInsertItem(*newItem); navigateTo(*newItem); @@ -249,8 +249,9 @@ void ThreadList::updateItems() void ThreadList::updateItem(ThreadListItem &item) { MsgThreadItemRef msgThread = m_App.getMsgEngine().getStorage().getThread(item.getThreadId()); - if (!msgThread) { - MSG_LOG_ERROR("msgThread is null"); + if (!msgThread || !msgThread->getId().isValid()) { + MSG_LOG_ERROR("msgThread is not valid"); + item.destroy(); return; } @@ -324,7 +325,6 @@ void ThreadList::onMsgStorageThreadDelete(const ThreadId &threadId) ListView::deleteItem(*thread); updateSelectAllItem(); } - if (m_pListener) m_pListener->onThreadListChanged(); } diff --git a/src/MsgThread/Controller/src/ThreadListItem.cpp b/src/MsgThread/Controller/src/ThreadListItem.cpp index a3b1f6d5..3abe2057 100644 --- a/src/MsgThread/Controller/src/ThreadListItem.cpp +++ b/src/MsgThread/Controller/src/ThreadListItem.cpp @@ -81,8 +81,10 @@ void ThreadListItem::update(const MsgThreadItem &threadItem, bool updateUi) m_UnreadCount = std::to_string(count); } } + } else { + MSG_LOG_WARN("empty conv list"); + return; } - setState(state, false); updateMessage(threadItem); updateThumbnailAndName(threadItem, true); -- 2.34.1