From 3d0d67a9a0a3103eb32deea65fc58456d9106b1d Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Tue, 20 Jul 2021 13:16:19 -0700 Subject: [PATCH] Clear flight path segments on rebuild. Fixes crash on RTL in middle of items. --- src/MissionManager/MissionController.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MissionManager/MissionController.cc b/src/MissionManager/MissionController.cc index ad6848b..40b2a48 100644 --- a/src/MissionManager/MissionController.cc +++ b/src/MissionManager/MissionController.cc @@ -1287,8 +1287,13 @@ void MissionController::_recalcFlightPathSegments(void) // Mission Settings item needs to start with no segment lastFlyThroughVI->clearSimpleFlighPathSegment(); - // Grovel through the list of items keeping track of things needed to correctly draw waypoints lines + // We need to clear the simple flight path segments on all items since they are going to be rebuilt. We can't just do this in the main loop + // below since that loop won't always process all items. + for (int i=1; i<_visualItems->count(); i++) { + qobject_cast(_visualItems->get(i))->clearSimpleFlighPathSegment(); + } + // Grovel through the list of items keeping track of things needed to correctly draw waypoints lines for (int i=1; i<_visualItems->count(); i++) { VisualMissionItem* visualItem = qobject_cast(_visualItems->get(i)); SimpleMissionItem* simpleItem = qobject_cast(visualItem);