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

Bugfix: SetDefaultParameter no longer puts duplicate copies in vector #257

Conversation

AyanRoy16
Copy link
Collaborator

Change is made to make sure that the input vector reference is not duplicated.

[x] Code changes made
[x] Test case added

@AyanRoy16 AyanRoy16 requested a review from nathanwbrei October 20, 2023 17:08
@AyanRoy16 AyanRoy16 self-assigned this Oct 20, 2023
Parse(param->GetValue(),t);
val = t;
Parse(param->GetValue(),t1);
val = t1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should fix the bug, but I think it misses the root cause, which is that the vector version of Parse() is appending to t without clearing it first.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We might run into other bugs with Parse<std::string, std::vector<T> val>() down the road if we don't clear val

src/programs/tests/JParameterManagerTests.cc Show resolved Hide resolved
@nathanwbrei nathanwbrei merged commit 4fa5ec2 into master Oct 20, 2023
3 checks passed
@nathanwbrei nathanwbrei deleted the AyanRoy16_issue_256_duplication_of_vector_default_parameters branch October 20, 2023 18:35
@nathanwbrei nathanwbrei changed the title Removing duplicate copying into input vector in SetDefaultParameter Bugfix: SetDefaultParameter no longer puts duplicate copies in vector Oct 20, 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