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

[5.2] Make sure unguarded() does not change unguarded state on exception #13184

Closed
wants to merge 1 commit into from

Conversation

jeroennoten
Copy link
Contributor

@jeroennoten jeroennoten commented Apr 16, 2016

This makes sure that when an exception is thrown in the callback passed to Model::unguarded(), the Model is still guarded afterwards. It uses the try .. finally construct. I also added a unit test.

A use case when this can happen is in FactoryBuilder::makeInstance, which throws an exception when it cannot find the model factory. In tests, this can result in strange errors in other tests, because all models are unguarded afterwards (also in other test cases) when this exception is thrown. So then tests will fail when they shouldn't. This PR prevents this kind of situations.

@jeroennoten jeroennoten changed the title Make sure unguarded() does not change unguarded state on exception [5.2] Make sure unguarded() does not change unguarded state on exception Apr 16, 2016
@GrahamCampbell
Copy link
Member

Please send this bug fix to 5.1.

@jeroennoten
Copy link
Contributor Author

Done: #13186

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