From 5670fe0ada930a036fe333a2f0d04b1def3c7409 Mon Sep 17 00:00:00 2001 From: Abhishek Bandyopadhyay Date: Thu, 27 Apr 2023 22:04:54 +0530 Subject: [PATCH] [android] Fixed the crash while clicking on Deleted Bookmark Lists On Bookmarks Lists page, if a User has created a new List along with `My Places` List and then deletes it, the deleted item stays on the List. Now, if the user clicks on the deleted List Item then the app was crashing as the deleted item is unavailable. Root cause of this issue is below - - When a `category` is deleted then `deleteCategory()` of `BookmarkManager` gets called. - The `deleteCategory()` internally calls `nativeDeleteCategory()`. - After a `category` is successfully deleted, then `OnBookmarksChanged()` should be invoked in order to update the List. But this wasn't happening. So deleted category wasn't getting removed from the cached list. Thus the user deleted category was visible even after deletion. - When the user clicked on the deleted `category`, it'll eventually crash as the `category` itself isn't present Fix: Properly notify the UI about the deleted list from BookmarkManager::NotifyChanges() Fixes: #3828 Signed-off-by: Abhishek Bandyopadhyay Signed-off-by: Alexander Borsuk --- map/bookmark_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 8f19c11e62..3d092364d8 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -3051,8 +3051,8 @@ void BookmarkManager::MarksChangesTracker::OnDeleteGroup(kml::MarkGroupId groupI auto const it = m_createdGroups.find(groupId); if (it != m_createdGroups.end()) m_createdGroups.erase(it); - else - m_removedGroups.insert(groupId); + + m_removedGroups.insert(groupId); } void BookmarkManager::MarksChangesTracker::OnUpdateGroup(kml::MarkGroupId groupId)