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

DYN-6103 Fix crash when undoing a group to group addition #14219

Closed
wants to merge 3 commits into from

Conversation

zeusongit
Copy link
Contributor

Purpose

https://jira.autodesk.com/browse/DYN-6103

In case of 3 groups if we combine them it will add the other 2 groups to the main group.
The crash occurred was while removing more than 1 group from a group.

We maintain a List of nested groups(geometry) and a Dictionary of their GUIDs and index at which they are stored in the list.
While splitting a nested group, we run a loop of all the groups that are nested inside the main group, since in this case we have 2 groups inside the main group, the loop will run twice, in natural order. So it will remove the group at index 0 and then 1 ...etc.
Removing the group at index 0 will change the size of the List, and when the second iteration is run to remove the group at index 1, it throws the index out of bounds error, since the list has only 1 element at index 0 now.

To fix this I am running the loop backwards, so we always remove groups from the list starting from the end, and we will always find the current index in the list.

Also, edited the test to catch this error, which only tested with 2 groups previously.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

  • Fix crash when undoing a group to group addition

Reviewers

@DynamoDS/dynamo

@zeusongit zeusongit added this to the 2.19.0 milestone Aug 2, 2023
@zeusongit
Copy link
Contributor Author

Will be closing this PR without merging, as changes in this PR were small enough and conflicting with the other PR (#14220).

@zeusongit zeusongit removed this from the 2.19.0 milestone Aug 3, 2023
@zeusongit zeusongit closed this Aug 3, 2023
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