Fixed map tests crash on traffic manager destruction.

This commit is contained in:
Daria Volvenkova 2016-12-08 14:53:06 +03:00
parent 6a7faa2a05
commit 0301f3d275
3 changed files with 9 additions and 9 deletions

View file

@ -461,6 +461,7 @@ Framework::Framework()
Framework::~Framework()
{
m_trafficManager.Teardown();
DestroyDrapeEngine();
m_model.SetOnMapDeregisteredCallback(nullptr);
}

View file

@ -52,21 +52,24 @@ TrafficManager::TrafficManager(GetMwmsByRectFn const & getMwmsByRectFn, size_t m
TrafficManager::~TrafficManager()
{
ASSERT(m_isTeardowned, ());
#ifdef DEBUG
{
lock_guard<mutex> lock(m_mutex);
ASSERT(!m_isRunning, ());
}
#endif
}
void TrafficManager::Teardown()
{
{
lock_guard<mutex> lock(m_mutex);
if (!m_isRunning)
return;
m_isRunning = false;
}
m_condition.notify_one();
m_thread.join();
#ifdef DEBUG
m_isTeardowned = true;
#endif
}
void TrafficManager::SetStateListener(TrafficStateChangedFn const & onStateChangedFn)

View file

@ -141,8 +141,4 @@ private:
vector<MwmSet::MwmId> m_requestedMwms;
mutex m_mutex;
threads::SimpleThread m_thread;
#ifdef DEBUG
bool m_isTeardowned = false;
#endif
};