Fix crash while switch traffic on/off

This commit is contained in:
Sergey Yershov 2016-12-15 13:35:42 +03:00 committed by Vladimir Byko-Ianko
parent 54c58c2606
commit aca06a5f03

View file

@ -243,7 +243,13 @@ void TrafficManager::ThreadRoutine()
traffic::TrafficInfo info(mwm, m_currentDataVersion);
if (info.ReceiveTrafficData(m_trafficETags[mwm]))
string tag;
{
lock_guard<mutex> lock(m_mutex);
tag = m_trafficETags[mwm];
}
if (info.ReceiveTrafficData(tag))
{
OnTrafficDataResponse(move(info));
}
@ -252,6 +258,11 @@ void TrafficManager::ThreadRoutine()
LOG(LWARNING, ("Traffic request failed. Mwm =", mwm));
OnTrafficRequestFailed(move(info));
}
{
lock_guard<mutex> lock(m_mutex);
m_trafficETags[mwm] = tag;
}
}
mwms.clear();
}