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

Make fire_and_forget exception safe #17783

Merged
merged 2 commits into from
Aug 23, 2024
Merged

Make fire_and_forget exception safe #17783

merged 2 commits into from
Aug 23, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 23, 2024

This PR clones winrt::fire_and_forget and replaces the uncaught
exception handler with one that logs instead of terminating.
My hope is that this removes one source of random crashes.

Validation Steps Performed

I added a THROW_HR to TermControl::UpdateControlSettings
before and after the suspension point and ensured the application
won't crash anymore.

@lhecker lhecker added the Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. label Aug 23, 2024
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

I love this. Thanks!

Comment on lines -703 to +705
winrt::fire_and_forget TermControl::UpdateControlSettings(IControlSettings settings)
void TermControl::UpdateControlSettings(IControlSettings settings)
{
return UpdateControlSettings(settings, _core.UnfocusedAppearance());
UpdateControlSettings(settings, _core.UnfocusedAppearance());
Copy link
Member

Choose a reason for hiding this comment

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

📝 This is really the only change in this PR that isn't winrt::fire_and_forget --> safe_void_coroutine. Should be fine though.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

/me re-names this til::fire_and_forget

i can't be the only one that enjoyed the mental imagery of "fire and forget". very clear meaning IMO

I'll be curious to see what exceptions we're just gonna ignore now and how the side-effects will end up propagating to future code that executes.

@DHowett DHowett merged commit 47d9a87 into main Aug 23, 2024
20 checks passed
@DHowett DHowett deleted the dev/lhecker/fire-and-forget branch August 23, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants