Do not save bookmarks while migration is in progress.

This commit is contained in:
Daria Volvenkova 2018-04-20 17:45:57 +03:00 committed by Aleksandr Zatsepin
parent 853c1cd3dc
commit 2e1bffa01d
2 changed files with 11 additions and 1 deletions

View file

@ -838,7 +838,8 @@ void BookmarkManager::LoadBookmarks()
CHECK_THREAD_CHECKER(m_threadChecker, ());
ClearCategories();
m_loadBookmarksFinished = false;
if (!IsMigrated())
m_migrationInProgress = true;
NotifyAboutStartAsyncLoading();
GetPlatform().RunTask(Platform::Thread::File, [this]()
{
@ -946,6 +947,11 @@ void BookmarkManager::NotifyAboutFinishAsyncLoading(KMLDataCollectionPtr && coll
GetPlatform().RunTask(Platform::Thread::Gui, [this, collection]()
{
if (m_migrationInProgress)
{
m_migrationInProgress = false;
SaveBookmarks(m_bmGroupsIdList);
}
if (!collection->empty())
{
CreateCategories(std::move(*collection));
@ -1467,6 +1473,9 @@ void BookmarkManager::SaveBookmarks(kml::GroupIdCollection const & groupIdCollec
{
CHECK_THREAD_CHECKER(m_threadChecker, ());
if (m_migrationInProgress)
return;
auto kmlDataCollection = PrepareToSaveBookmarks(groupIdCollection);
if (!kmlDataCollection)
return;

View file

@ -451,6 +451,7 @@ private:
bool m_loadBookmarksFinished = false;
bool m_firstDrapeNotification = false;
bool m_restoreApplying = false;
bool m_migrationInProgress = false;
bool m_conversionInProgress = false;
ScreenBase m_viewport;