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

Possible Bugfix in Tree::remove(...) #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mues92
Copy link
Collaborator

@mues92 mues92 commented Jul 11, 2018

In Tree::remove(const shared_ptr thisNode, const shared_ptr otherNode) the thisNode->getChildren() list can change if children are deleted and removed.
In this case the iterator seems to get invalidated.
The new version could be one possible solution.

…ared_ptr<TreeNode> otherNode): Use while-loop with iterators instead of for-each-loop and check if thisNode->getChildren() has changed.
@ghost
Copy link

ghost commented Jul 11, 2018

The idea of this method is unclear to me. It's used in the wpMethod of the FSM and DFSM class to remove the state cover from the transition cover. This shouldn't have any effect.
In many cases the remove method has no effect, except marking nodes as deleted without deleting them.

So maybe we should rethink the whole method before merging a fix to the iterator problem.

@mues92
Copy link
Collaborator Author

mues92 commented Jul 12, 2018

Sounds like a good idea.

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.

1 participant