diff options
author | Roman Kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-09-24 16:58:58 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:16:33 +0300 |
commit | 956f41c5db82a527ac8bc8e53ff1ff9f41a50e76 (patch) | |
tree | fa5f66caadbba57ae314c26c29b093049209683c /map/bookmark_manager.cpp | |
parent | 46b2162ef9c840efcef9c1368ac967ba549bbff5 (diff) |
Rebase fixes after migration to github
Diffstat (limited to 'map/bookmark_manager.cpp')
-rw-r--r-- | map/bookmark_manager.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 72b5667940..48f021a657 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -19,10 +19,9 @@ BookmarkManager::BookmarkManager(Framework & f) : m_framework(f) { m_userMarkLayers.reserve(3); - ///@TODO UVR - m_userMarkLayers.push_back(new SearchUserMarkContainer(0.0/*graphics::activePinDepth*/, m_framework)); - m_userMarkLayers.push_back(new ApiUserMarkContainer(0.0/*graphics::activePinDepth*/, m_framework)); - //m_userMarkLayers.push_back(new DebugUserMarkContainer(graphics::debugDepth, m_framework)); + m_userMarkLayers.push_back(new SearchUserMarkContainer(0.0 /* activePinDepth */, m_framework)); + m_userMarkLayers.push_back(new ApiUserMarkContainer(0.0 /* activePinDepth */, m_framework)); + m_userMarkLayers.push_back(new DebugUserMarkContainer(0.0 /* debugDepth */, m_framework)); UserMarkContainer::InitStaticMarks(FindUserMarksContainer(UserMarkType::SEARCH_MARK)); } @@ -79,6 +78,15 @@ void BookmarkManager::LoadBookmark(string const & filePath) m_categories.push_back(cat); } +void BookmarkManager::InitBookmarks() +{ + for (auto it = m_categories.begin(); it != m_categories.end(); ++it) + { + BookmarkCategory * cat = *it; + BookmarkCategory::Guard guard(*cat); + } +} + size_t BookmarkManager::AddBookmark(size_t categoryIndex, m2::PointD const & ptOrg, BookmarkData & bm) { bm.SetTimeStamp(time(0)); @@ -100,14 +108,20 @@ size_t BookmarkManager::AddBookmark(size_t categoryIndex, m2::PointD const & ptO size_t BookmarkManager::MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex) { - BookmarkCategory * cat = m_framework.GetBmCategory(curCatIndex); - BookmarkCategory::Guard guard(*cat); - Bookmark const * bm = static_cast<Bookmark const *>(guard.m_controller.GetUserMark(bmIndex)); - BookmarkData data = bm->GetData(); - m2::PointD ptOrg = bm->GetPivot(); - - guard.m_controller.DeleteUserMark(bmIndex); - cat->SaveToKMLFile(); + BookmarkData data; + m2::PointD ptOrg; + + // guard must be released before AddBookmark to prevent deadlock + { + BookmarkCategory * cat = m_framework.GetBmCategory(curCatIndex); + BookmarkCategory::Guard guard(*cat); + Bookmark const * bm = static_cast<Bookmark const *>(guard.m_controller.GetUserMark(bmIndex)); + data = bm->GetData(); + ptOrg = bm->GetPivot(); + + guard.m_controller.DeleteUserMark(bmIndex); + cat->SaveToKMLFile(); + } return AddBookmark(newCatIndex, ptOrg, data); } |