-
Notifications
You must be signed in to change notification settings - Fork 11
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 #284, "fixed_step_algorithm crashes when a variable is reconnected" #285
Fix #284, "fixed_step_algorithm crashes when a variable is reconnected" #285
Conversation
The problem was that fixed_step_algorithm::impl::disconnect_variable didn't check whether `it` pointed to an actual element before trying to erase it. This also fixes an unrelated hidden bug in the same function: The `conns` variable was a *copy* of the connection list, and not a reference to it as was intended. This would have rendered the entire function a no-op.
Why are we trying to disconnect or erase a connection that doesn't exist? EDIT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! It would however be nice to see this tested - just something as simple as adding the same connection twice.
Almost. It looks for the one that has an output variable which is connected to the input variable in question.
The loop body would crash for all simulators that did not have the connection. Maybe we just haven't tested this functionality yet, or maybe we've only tested it in cases where |
And here I was hoping to get away without it. :D But I agree and will fix. |
…en-a-variable-is-reconnected
Test added now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good 👍
As the test requested by @eidekrist is included now we can merge.
The problem was that
fixed_step_algorithm::impl::disconnect_variable()
didn't check whetherit
pointed to an actual element before trying to erase it.This PR also fixes an unrelated hidden bug in the same function: The
conns
variable was a copy of the connection list, and not a reference to it as was intended. This would have rendered the entire function a no-op.