Skip to content

GpxListIterator: fix primer nodes capturing stale list head#206

Merged
bailuk merged 1 commit intobailuk:stagefrom
MaxKellermann:gpxlistiterator-fix-primer
Feb 26, 2026
Merged

GpxListIterator: fix primer nodes capturing stale list head#206
bailuk merged 1 commit intobailuk:stagefrom
MaxKellermann:gpxlistiterator-fix-primer

Conversation

@MaxKellermann
Copy link
Copy Markdown
Contributor

The Java-to-Kotlin conversion in PR #202 changed the primer node getNext() overrides from dynamic methods into stored properties (override var next = ...), which captured the list's first element once at construction time. When GpxListWriter creates the iterator on an initially empty list, the primer's next stays null permanently, so writeNewPoints() never iterates and no points are written to the GPX log file.

Fix by using computed properties that read the current list head on every access, matching the original Java behavior.

Regression introduced in #202

The Java-to-Kotlin conversion in PR bailuk#202 changed the primer node
getNext() overrides from dynamic methods into stored properties
(override var next = ...), which captured the list's first element
once at construction time. When GpxListWriter creates the iterator
on an initially empty list, the primer's next stays null permanently,
so writeNewPoints() never iterates and no points are written to the
GPX log file.

Fix by using computed properties that read the current list head on
every access, matching the original Java behavior.

Regression introduced in bailuk#202
@MaxKellermann
Copy link
Copy Markdown
Contributor Author

@bailuk, this fixes a serious regression which broke the GPX logger completely. I lost today's 200km ride :-(

@MaxKellermann MaxKellermann marked this pull request as ready for review February 25, 2026 16:54
@bailuk
Copy link
Copy Markdown
Owner

bailuk commented Feb 26, 2026

@bailuk, this fixes a serious regression which broke the GPX logger completely. I lost today's 200km ride :-(

Sorry for that. I do not always fully test changes before merging them into stage. Stage is kind of a developer branch that should get more stable when coming closer to a release.

@bailuk
Copy link
Copy Markdown
Owner

bailuk commented Feb 26, 2026

I will extend GpxListWriterTest.kt later to cover this kind of bug

@bailuk bailuk merged commit 19213cb into bailuk:stage Feb 26, 2026
@MaxKellermann
Copy link
Copy Markdown
Contributor Author

No problem, I know that riding with an unstable branch has these risks. And I could recover the positional data from my Beacon server and convert it to a GPX.

@MaxKellermann MaxKellermann deleted the gpxlistiterator-fix-primer branch February 27, 2026 07:48
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.

2 participants