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

Add lifetime to solution #149

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Conversation

Andful
Copy link

@Andful Andful commented Aug 23, 2024

This is my proposed solution to #138.
Had to change create_sol to admit &self instead of &mut self (because otherwise model cannot be borrowed). With this changes should make it not possible to perform use after free (with solution, clone_for_plugin seems to also allow use after free).
The tests pass otherwise.

Do of this what you want.

@Andful
Copy link
Author

Andful commented Aug 23, 2024

A more robust solution might be to add a lifetime directly to ScipPtr. So have OwnedScip and ScipRef<'a> instead of the consumed field.

@mmghannam
Copy link
Member

Thank you very much @Andful! This solution works great for now and I added your suggestion as an issue to tackle later.

Fixes #138

@mmghannam mmghannam merged commit d3507d1 into scipopt:main Sep 13, 2024
4 of 5 checks passed
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