From 4fa132731b41672beec2985869d061d79ae5ef56 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 16 Feb 2023 14:33:39 +0000 Subject: [PATCH] Remove satellites from map on close --- .../satellitetracker/satellitetrackerworker.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/feature/satellitetracker/satellitetrackerworker.cpp b/plugins/feature/satellitetracker/satellitetrackerworker.cpp index aca2b00f7..81b7bd4d1 100644 --- a/plugins/feature/satellitetracker/satellitetrackerworker.cpp +++ b/plugins/feature/satellitetracker/satellitetrackerworker.cpp @@ -68,6 +68,16 @@ SatelliteTrackerWorker::~SatelliteTrackerWorker() qDebug() << "SatelliteTrackerWorker::~SatelliteTrackerWorker"; stopWork(); m_inputMessageQueue.clear(); + // Remove satellites from Map + QHashIterator itr(m_workerState); + while (itr.hasNext()) + { + itr.next(); + if (m_settings.m_drawOnMap) { + removeFromMap(itr.key()); + } + } + qDeleteAll(m_workerState); } void SatelliteTrackerWorker::startWork() @@ -187,7 +197,13 @@ void SatelliteTrackerWorker::applySettings(const SatelliteTrackerSettings& setti { itr.next(); if (settings.m_satellites.indexOf(itr.key()) == -1) + { + if (m_settings.m_drawOnMap) { + removeFromMap(itr.key()); + } + delete itr.value(); itr.remove(); + } } // Add new satellites