Skip to content
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

Fix #87 Scene appears to delete wrong item #97

Merged
merged 9 commits into from
Aug 12, 2021

Conversation

firthm01
Copy link
Collaborator

Closes #87

ElementViewList maintained a std::vector<ElementView*> elements_;, and ElementsContainer also maintained a std::vector<std::shared_ptr<ElementView>> elements; - these could get out of sync, and hence why the UI appeared to be deleting the wrong item.

The easy fix would have been to modify the JuceSceneFrontendConnector::elementMoved method to ensure it updates the ordering of vector elements in the ElementViewList (which it already did) AND the vector of elements in ElementsContainer such that the indices always matched and operations were always enacted on the correct vector elements.

However, it seemed redundant to me to be maintaining two vectors. It seems much more logical to just use the vector in ElementsContainer, and all operations concerning adding, moving and removing elements to be handled by ElementsContainer (this also meant moving the listeners to ElementsContainer too).

@firthm01 firthm01 requested a review from rsjbailey July 29, 2021 16:44
Copy link
Contributor

@rsjbailey rsjbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, could you rebase on top of main & squash to maybe 2 commits (1 for the actual fix, one for the refactor?).

@firthm01 firthm01 force-pushed the 87-scene-delete-wrong-item branch from 8202f19 to e3950bd Compare August 11, 2021 16:48
@firthm01
Copy link
Collaborator Author

Looks good, could you rebase on top of main & squash to maybe 2 commits (1 for the actual fix, one for the refactor?).

Rebase done and the changes requested.

Not sure I understand what you mean by squashing to a fix commit and a refactor commit. Really, there wasn't a fix as such - the refactor removed the issue (using only one vector, so no need to synchronise them)

@firthm01 firthm01 requested a review from rsjbailey August 11, 2021 18:14
@rsjbailey rsjbailey merged commit 6917626 into main Aug 12, 2021
@rsjbailey rsjbailey deleted the 87-scene-delete-wrong-item branch October 27, 2021 08:54
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.

Scene appears to delete wrong items
2 participants