Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2015-09-15 11:12:32 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:05:17 +0300
commitfb7b1382a8783c863e58bacb31ada0032e9661c2 (patch)
tree703713b91549f3e375b10d2d409d46df50f6cf36 /indexer/index.cpp
parentb2fd03c0877ac34ebe54cc256eb809a5fd289478 (diff)
[indexer] Fixed memory leaks related to MwmValues.
Diffstat (limited to 'indexer/index.cpp')
-rw-r--r--indexer/index.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/indexer/index.cpp b/indexer/index.cpp
index f8adf0c82d..508e0306c0 100644
--- a/indexer/index.cpp
+++ b/indexer/index.cpp
@@ -36,7 +36,7 @@ void MwmValue::SetTable(MwmInfoEx & info)
// Index implementation
//////////////////////////////////////////////////////////////////////////////////
-MwmInfoEx * Index::CreateInfo(platform::LocalCountryFile const & localFile) const
+unique_ptr<MwmInfo> Index::CreateInfo(platform::LocalCountryFile const & localFile) const
{
MwmValue value(localFile);
@@ -44,7 +44,7 @@ MwmInfoEx * Index::CreateInfo(platform::LocalCountryFile const & localFile) cons
if (!h.IsMWMSuitable())
return nullptr;
- MwmInfoEx * info = new MwmInfoEx();
+ unique_ptr<MwmInfoEx> info(new MwmInfoEx());
info->m_limitRect = h.GetBounds();
pair<int, int> const scaleR = h.GetScaleRange();
@@ -52,16 +52,15 @@ MwmInfoEx * Index::CreateInfo(platform::LocalCountryFile const & localFile) cons
info->m_maxScale = static_cast<uint8_t>(scaleR.second);
info->m_version = value.GetMwmVersion();
- return info;
+ return unique_ptr<MwmInfo>(move(info));
}
-MwmValue * Index::CreateValue(MwmInfo & info) const
+unique_ptr<MwmSet::MwmValueBase> Index::CreateValue(MwmInfo & info) const
{
unique_ptr<MwmValue> p(new MwmValue(info.GetLocalFile()));
p->SetTable(dynamic_cast<MwmInfoEx &>(info));
ASSERT(p->GetHeader().IsMWMSuitable(), ());
-
- return p.release();
+ return unique_ptr<MwmSet::MwmValueBase>(move(p));
}
pair<MwmSet::MwmHandle, MwmSet::RegResult> Index::RegisterMap(LocalCountryFile const & localFile)