From e8b9fd7af432245fa57186eaae11f3b5b602e518 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 7 Dec 2018 13:57:04 -0800 Subject: [PATCH] Fix handling of dirty bit when home position changes from vehicle side --- src/MissionManager/MissionController.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index 671613438..f03b8fa83 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -1714,15 +1714,20 @@ void MissionController::managerVehicleChanged(Vehicle* managerVehicle) void MissionController::_managerVehicleHomePositionChanged(const QGeoCoordinate& homePosition) { if (_visualItems) { + bool currentDirtyBit = dirty(); + MissionSettingsItem* settingsItem = qobject_cast(_visualItems->get(0)); if (settingsItem) { settingsItem->setHomePositionFromVehicle(homePosition); } else { qWarning() << "First item is not MissionSettingsItem"; } - // Don't let this trip the dirty bit. Otherwise plan will keep getting marked dirty if vehicle home - // changes. - _visualItems->setDirty(false); + + if (!currentDirtyBit) { + // Don't let this trip the dirty bit. Otherwise plan will keep getting marked dirty if vehicle home + // changes. + _visualItems->setDirty(false); + } } } -- 2.22.0