-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layers.java public synchronized Layer set(int index, Layer layer) not binding correctly #1116
Comments
@stleusc thanks for the report. The remove also changes the group pointers, so better not mix them. We could just add the missing bindings from the add. |
but should the group pointers NOT be updated? Looking at I think there is something else missing regarding groups?! |
That's why the remove (used with or without groups) should not be used in regular set. The regular add(int index, Layer layer) and set(int index, Layer layer) override List methods For groups must use the extra add(Layer layer, int group) method. |
Guess I need to ask in a better way... IF I plan to add a layer (no group) and then remove it, I would do the follwing:
But that does modify the It seems liket that is not correct?! I understand how I could make Somehow the generic remove function needs to know if we are in need of messing with |
No, the remove does not modify the mGroupList. Anyway groups should either be used for all levels or not. |
I don't think we understand each other.... I try to explain better. I want to be able to remove a layer, and at a later time, add a layer. I call
and
Why does the second function contain the portion marked? Does that NOT mess with You said early on, I should NOT call remove followed by an add. Does this make more sense now? |
If layers size changes, the group index should be updated. And like already mentioned:
So if not using groups there is no problem. I said we should not call remove / add inside the set, |
https://github.com/mapsforge/vtm/blob/6eecba7c022de8967160d78a758ba20db96db359/vtm/src/org/oscim/map/Layers.java#L180C4-L214C6
The set function should behave like calling remove() followed by add().
However, set only UNBINDS the old layer, never binds the new layer.
Likely could be fixed and simplified by just calling remove() add().
The text was updated successfully, but these errors were encountered: