[PR #12580] Fix a crash setting the hotkey during teardown #29126

Open
opened 2026-01-31 09:32:57 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/12580

State: closed
Merged: Yes


From MSFT:36797001. Okay so this is only .22% of our crashes, but every little bit helps, right?

Turns out this is also hitting in:

  • MSFT:35726322
  • MSFT:34662459

and together they're a fairly hot bug.

There's a large class of bugs where we might get a callback to one of our event handlers when we call app.Close() in the AppHost dtor. This PR adds manual revokers to these events, and makes sure to revoke them BEFORE nulling out the _window. That will prevent callbacks during the rest of the dtor, when the _window is null.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/12580 **State:** closed **Merged:** Yes --- From MSFT:36797001. Okay so this is only .22% of our crashes, but every little bit helps, right? Turns out this is also hitting in: * MSFT:35726322 * MSFT:34662459 and together they're a fairly hot bug. There's a large class of bugs where we might get a callback to one of our event handlers when we call `app.Close()` in the `AppHost` dtor. This PR adds manual revokers to these events, and makes sure to revoke them BEFORE nulling out the `_window`. That will prevent callbacks during the rest of the dtor, when the `_window` is null.
claunia added the pull-request label 2026-01-31 09:32:57 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29126