Fix ConcurrentModificationException when dragging points in Mapbox#7190
Merged
grzesiek2010 merged 2 commits intogetodk:masterfrom Apr 21, 2026
Merged
Fix ConcurrentModificationException when dragging points in Mapbox#7190grzesiek2010 merged 2 commits intogetodk:masterfrom
grzesiek2010 merged 2 commits intogetodk:masterfrom
Conversation
36d5adf to
1d3e36c
Compare
seadowg
requested changes
Apr 21, 2026
Member
seadowg
left a comment
There was a problem hiding this comment.
Looks good, but I think we should have comments before the post calls to make sure it's clear why this is happening.
seadowg
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7185
Why is this the best possible solution? Were any other approaches considered?
When a point annotation is dragged and released, Mapbox invokes our
onAnnotationDragFinished()callback before finishing its internal processing. We were callingfeatureDragEndListener.onFeature()synchronously inside that callback, which triggered a chain of events that caused the polyline feature to be disposed and recreated all beforeonAnnotationDragFinished()returned. This modified Mapbox's internal state while it was still being processed, resulting in aConcurrentModificationException.The fix defers the
onFeature()call usingHandler(Looper.getMainLooper()).post {}, so the feature update happens after Mapbox finishes processing the drag event.A more optimal solution could be to update the polyline/polygon in place rather than disposing and recreating it entirely (maybe that would also fix this issue). However, the current pattern is shared across all three map engines, so changing it would require a broader refactor. Given that we are planning to migrate to
MapLibrein the near future, this does not seem worth addressing at this point.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Only the code responsible for dragging points in geotrace/geoshape with Mapbox has been changed, so testing can be focused on this functionality only.
Do we need any specific form for testing your changes? If so, please attach one.
The
All question typesform is ok.Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest(or./gradlew testLab) and confirmed all checks still passDateFormatsTest