merlos / iOS-Open-GPX-Tracker

GPS Tracker app for iOS + WatchOS. Log your tracks without limits and share them; Open source GPX tracker app written in Swift
http://www.merlos.org/iOS-Open-GPX-Tracker/
GNU General Public License v3.0
605 stars 149 forks source link

Duplicated track of recovered session #177

Closed vincentneo closed 4 years ago

vincentneo commented 4 years ago

The recovered session (option 1, post-crash) from a crash scenario will result in duplicated tracks. First observed when total distance was doubled post crash recovery.

It appears that at time of recovery, tracks appears not duplicated (unless my testing was incorrect), but once recovered session is saved, the duplication is saved as well.

Tested on latest commit, master branch. Issue appears to be not present in v1.7.2 App Store version.

vincentneo commented 4 years ago

related to exportToGPXString() of GPXSession, for the saving part, where

        //add existing tracks
        gpx.add(tracks: self.tracks)
        //add current track
        gpx.add(track: track)

Adds twice. Presume its with how recovery is done, possibly with line 157 of GPXSession. Don't get why it doesn't happen with the App Store one, as it seems code regarding to it did not change much over the course.

Not quite sure why when initially loading the recovered, instances does not show duplication, but distance and polyline appears duplicated already.

UPDATE: definitely something to do with line 160 of GPXSession.swift

        //self.tracks.removeLast()