Skip to content

Conversation

@mrschick
Copy link
Contributor

Description

Fixes #12852. Stumbled upon this way of solving it by trying to apply the beginReset() and endReset() functions also used in QGCMapPolylineVisuals.qml, where they worked correctly to prevent old vertices from persisting (confirmed by trying to comment them out).

/// Reset polyline back to initial default
function _resetPolyline() {
mapPolyline.beginReset()
mapPolyline.clear()
var initialVertices = _defaultPolylineVertices()
mapPolyline.appendVertex(initialVertices[0])
mapPolyline.appendVertex(initialVertices[1])
mapPolyline.endReset()
}

Test Steps

The repro case in #12852 won't work anymore, related UI manipulation is not broken by the fix.

Checklist:

Related Issue

Will fix #12852.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@HTRamsey
Copy link
Collaborator

Yeah the _beginResetIfNotActive/_endResetIfNotActive functions don't make sense to me, because _beginResetIfNotActive sets active to true then _endResetIfNotActive doesn't work because active is then true

@mrschick mrschick force-pushed the fix/polyline-vertex-persistence branch from f9b95da to a010a10 Compare May 22, 2025 07:04
@HTRamsey HTRamsey merged commit 9c98cfe into mavlink:master May 22, 2025
11 checks passed
@mrschick mrschick deleted the fix/polyline-vertex-persistence branch May 23, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Importing Polyline from KML does not remove previous polyline, CTD potential

2 participants