diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2018-04-10 20:00:19 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2018-04-10 20:16:24 +0300 |
commit | 51999dc7da2580e1901728d24a37b3a7663ca646 (patch) | |
tree | 04f43f992b9540c29d4e35bb26e2050d2c091eab /map/bookmark_manager.cpp | |
parent | 06244219347755da6082dd6b4c9e3faad657fa54 (diff) |
Block bookmarks file loading while applying bookmarks restore.
Diffstat (limited to 'map/bookmark_manager.cpp')
-rw-r--r-- | map/bookmark_manager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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(); } }); |