Merge pull request #6138 from milchakov/traffic_manager_fix

traffic manager map deregistered fix
This commit is contained in:
Daria Volvenkova 2017-05-26 19:00:31 +03:00 committed by GitHub
commit 40bf5c7a0f
4 changed files with 7 additions and 7 deletions

View file

@ -239,7 +239,7 @@ public:
// Called when a map is updated to a newer version. Feel free to
// treat it as combined OnMapRegistered(newFile) +
// OnMapRegistered(oldFile).
// OnMapDeregistered(oldFile).
virtual void OnMapUpdated(platform::LocalCountryFile const & /*newFile*/,
platform::LocalCountryFile const & /*oldFile*/) {}

View file

@ -665,11 +665,9 @@ bool Framework::OnCountryFileDelete(storage::TCountryId const & countryId, stora
bool deferredDelete = false;
if (localFile)
{
auto const mwmId = m_model.GetIndex().GetMwmIdByCountryFile(platform::CountryFile(countryId));
rect = m_infoGetter->GetLimitRectForLeaf(countryId);
m_model.DeregisterMap(platform::CountryFile(countryId));
deferredDelete = true;
m_trafficManager.OnMwmDelete(mwmId);
m_localAdsManager.OnDeleteCountry(countryId);
}
InvalidateRect(rect);
@ -691,6 +689,9 @@ void Framework::OnMapDeregistered(platform::LocalCountryFile const & localFile)
action();
else
GetPlatform().RunOnGuiThread(action);
auto const mwmId = m_model.GetIndex().GetMwmIdByCountryFile(localFile.GetCountryFile());
m_trafficManager.OnMwmDeregistered(mwmId);
}
bool Framework::HasUnsavedEdits(storage::TCountryId const & countryId)

View file

@ -141,7 +141,7 @@ void TrafficManager::SetCurrentDataVersion(int64_t dataVersion)
m_currentDataVersion = dataVersion;
}
void TrafficManager::OnMwmDelete(MwmSet::MwmId const & mwmId)
void TrafficManager::OnMwmDeregistered(MwmSet::MwmId const & mwmId)
{
if (!IsEnabled())
return;
@ -237,8 +237,7 @@ void TrafficManager::ThreadRoutine()
{
for (auto const & mwm : mwms)
{
auto const & mwmInfo = mwm.GetInfo();
if (!mwmInfo)
if (!mwm.IsAlive())
continue;
traffic::TrafficInfo info(mwm, m_currentDataVersion);

View file

@ -79,7 +79,7 @@ public:
void OnDestroyGLContext();
void OnRecoverGLContext();
void OnMwmDelete(MwmSet::MwmId const & mwmId);
void OnMwmDeregistered(MwmSet::MwmId const & mwmId);
void OnEnterForeground();
void OnEnterBackground();