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

Avoid assertion failures in deinitializers #168

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

tristanlabelle
Copy link
Contributor

There may be cases where a clean deinitialization is impossible. We should not assert in the deinit because it will always force the program to terminate in debug builds. Rather swallow errors and provide a way to handle them before deinit.

@tristanlabelle tristanlabelle requested review from jeffdav and a team December 6, 2024 18:49
Copy link

@z2oh z2oh left a comment

Choose a reason for hiding this comment

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

What happens when an error is unhandled in a deinit? I tried googling but couldn't find a good answer

@tristanlabelle
Copy link
Contributor Author

@z2oh I think a deinit simply cannot be throws, so you have to handle your errors like with any other non-throws function.

@tristanlabelle tristanlabelle merged commit 5bae870 into main Dec 6, 2024
2 checks passed
@tristanlabelle tristanlabelle deleted the tristan/no-destructor-assert branch December 6, 2024 19:46
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