Hot fix for PyEval error

This commit is contained in:
Praveen Kumar 2020-04-15 12:44:43 +05:30 committed by bernat
parent 3a36b16378
commit 50281d7ecb
2 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@
namespace carla {
namespace traffic_manager {
std::map<uint16_t, std::unique_ptr<TrafficManagerBase>> TrafficManager::_tm_map;
std::map<uint16_t, TrafficManagerBase*> TrafficManager::_tm_map;
std::mutex TrafficManager::_mutex;
TrafficManager::TrafficManager(
@ -40,7 +40,7 @@ void TrafficManager::Release() {
std::lock_guard<std::mutex> lock(_mutex);
for(auto& tm : _tm_map) {
tm.second->Release();
TrafficManagerBase *base_ptr = tm.second.release();
TrafficManagerBase *base_ptr = tm.second;
delete base_ptr;
}
_tm_map.clear();
@ -150,7 +150,7 @@ void TrafficManager::CreateTrafficManagerServer(
#endif
/// Set the pointer of the instance
_tm_map.insert(std::make_pair(port, std::unique_ptr<TrafficManagerBase>(tm_ptr)));
_tm_map.insert(std::make_pair(port, tm_ptr));
}
@ -187,7 +187,7 @@ bool TrafficManager::CreateTrafficManagerClient(
tm_ptr->HealthCheckRemoteTM();
/// Set the pointer of the instance
_tm_map.insert(std::make_pair(port, std::unique_ptr<TrafficManagerBase>(tm_ptr)));
_tm_map.insert(std::make_pair(port, tm_ptr));
result = true;
}

View File

@ -235,12 +235,12 @@ private:
auto it = _tm_map.find(port);
if (it != _tm_map.end()) {
_mutex.unlock();
return it->second.get();
return it->second;
}
return nullptr;
}
static std::map<uint16_t, std::unique_ptr<TrafficManagerBase>> _tm_map;
static std::map<uint16_t, TrafficManagerBase*> _tm_map;
static std::mutex _mutex;
uint16_t _port = 0;