[PR #1015] Fix #936: misuse of uninitialized objects causes AppVerifier breaks on Windows Terminal startup #24445

Closed
opened 2026-01-31 09:03:21 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


This PR makes a couple of small changes:

  • In src\cascadia\TerminalControl\TermControl.cpp, the TermControl::_InitializeTerminal() method now initializes the RenderThread it creates before making any calls into the Renderer it also creates, as the Renderer has been given the RenderThread and expects it to be fully initialized.
  • In src\renderer\base\thread.cpp, the RenderThread's members of type HANDLE are now initialized to NULL instead of INVALID_HANDLE_VALUE. The latter is not appropriate for these HANDLEs because they are returned from CreateThread() or CreateEvent(), which both return NULL on failure.

Using manual testing, I verified that either of these changes alone will resolve one or both of the 2 AppVerifier stops cited in the bug report.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/1015 **State:** closed **Merged:** Yes --- This PR makes a couple of small changes: - In src\cascadia\TerminalControl\TermControl.cpp, the `TermControl::_InitializeTerminal()` method now initializes the `RenderThread` it creates before making any calls into the `Renderer` it also creates, as the Renderer has been given the RenderThread and expects it to be fully initialized. - In src\renderer\base\thread.cpp, the RenderThread's members of type `HANDLE` are now initialized to NULL instead of INVALID_HANDLE_VALUE. The latter is not appropriate for these HANDLEs because they are returned from CreateThread() or CreateEvent(), which both return NULL on failure. Using manual testing, I verified that either of these changes alone will resolve one or both of the 2 AppVerifier stops cited in the bug report. <!-- Please review the items on the PR checklist before submitting--> ### PR Checklist * [x] Closes #936 TermControl._InitializeTerminal() gives Renderer an uninitialized RenderThread then calls into Renderer. Cleanup needed? * [x] I've discussed this with core contributors already -- See bug thread - mr * [ ] Tests added/passed -- not sure where to put new test code? - mr
claunia added the pull-request label 2026-01-31 09:03:21 +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#24445