diff --git a/platform/location_service.cpp b/platform/location_service.cpp index c192ecb9d5..89ca49c315 100644 --- a/platform/location_service.cpp +++ b/platform/location_service.cpp @@ -50,7 +50,7 @@ public: class DesktopLocationService : public LocationService, public LocationObserver { - std::vector m_services; + std::vector> m_services; PositionFilter m_filter; bool m_reportFirstEvent; @@ -70,26 +70,20 @@ public: : LocationService(observer), m_reportFirstEvent(true) { #if defined(OMIM_OS_MAC) - m_services.push_back(CreateAppleLocationService(*this)); + m_services.push_back(std::unique_ptr(CreateAppleLocationService(*this))); #endif } - virtual ~DesktopLocationService() - { - for (size_t i = 0; i < m_services.size(); ++i) - delete m_services[i]; - } - virtual void Start() { - for (size_t i = 0; i < m_services.size(); ++i) - m_services[i]->Start(); + for (auto & service : m_services) + service->Start(); } virtual void Stop() { - for (size_t i = 0; i < m_services.size(); ++i) - m_services[i]->Stop(); + for (auto & service : m_services) + service->Stop(); m_reportFirstEvent = true; } };