Thanks for the patch.
I think your code is probably OK. Sean has done major work
done to refactor Tracks away from Routes, to support faster rendering of large/complex tracks. Not surprising that edge cases get missed.
Consider github commit:
which brings in a whole new track list(vector) implementation.
Also, note that you can invoke
by right-clicking on a track-point item(row) in the RouteManagerDialog.
If Sean has no comments, I'll merge your Pull Request.