diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index e1a9c0d5ba..e67a07c162 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -865,6 +865,8 @@ void BookmarkManager::LoadBookmarks() void BookmarkManager::LoadBookmark(std::string const & filePath, bool isTemporaryFile) { ASSERT_THREAD_CHECKER(m_threadChecker, ()); + if (m_restoreApplying) + return; if (!m_loadBookmarksFinished || m_asyncLoadingInProgress) { m_bookmarkLoadingQueue.emplace_back(filePath, isTemporaryFile); @@ -1654,6 +1656,9 @@ void BookmarkManager::OnSynchronizationStarted(Cloud::SynchronizationType type) { GetPlatform().RunTask(Platform::Thread::Gui, [this, type]() { + if (type == Cloud::SynchronizationType::Restore) + m_restoreApplying = true; + if (m_onSynchronizationStarted) m_onSynchronizationStarted(type); }); @@ -1670,11 +1675,12 @@ void BookmarkManager::OnSynchronizationFinished(Cloud::SynchronizationType type, if (m_onSynchronizationFinished) m_onSynchronizationFinished(type, result, errorStr); - if (type == Cloud::SynchronizationType::Restore && - result == Cloud::SynchronizationResult::Success) + if (type == Cloud::SynchronizationType::Restore) { + m_restoreApplying = false; // Reload bookmarks after restoring. - LoadBookmarks(); + if (result == Cloud::SynchronizationResult::Success) + LoadBookmarks(); } }); diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index 88e450ad08..7aabac5eab 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -447,6 +447,7 @@ private: size_t m_openedEditSessionsCount = 0; bool m_loadBookmarksFinished = false; bool m_firstDrapeNotification = false; + bool m_restoreApplying = false; ScreenBase m_viewport;