This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
Fix annotation icon replacement - #3320
Merged
Merged
Conversation
Another pass at #3146, including a unit test.
Contributor
There was a problem hiding this comment.
This should be prefix increment -- images.erase(++imageIterator). (For anyone who doesn't know: the reason is that std::map::erase invalidates any iterators pointing to the erased element. Prefix ++ both returns the original value for passing to erase, and increments just before the call. This is both very subtle and a standard C++ idiom in this situation.)
Contributor
There was a problem hiding this comment.
And of course, after writing that I realized I had it backwards. The current code is correct!
Contributor
|
Thanks for that, I'll try to add unit tests next time and better double check after pull request update |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Another pass at #3146, including a unit test.
Map::removeAnnotationIcon()was calling itself recursively instead ofMapContext::removeAnnotationIcon(), and an iterator inSpriteAtlas::updateDirty()needs to be incremented before the current element is removed from the map. Thanks to @jfirebaugh for spotting these issues./cc @RomainQuidet