Prevent GDI+ startup from blocking Windows shell - #628
Merged
Merged
Conversation
Initialize optional GDI+ rendering on a detached worker with mutex-protected publication and plain-GDI fallback, and add an exact 11-key child-process native-window regression. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent optional GDI+ initialization from blocking the Windows UI thread before
the native shell window is created. The beta5 Dev Box evidence narrowed the
90-second no-window hang to synchronous
GdiplusStartup; plain GDI remains thefallback until asynchronous initialization succeeds.
Changes
UI thread.
mutex, preventing data races and shutdown during active drawing.
while the process uses exactly the supported 11-key environment and must
still expose a native window within a bounded deadline.
exited/no-window/window and zero-observation outcomes.
Test plan
RED: pwsh -NoProfile -File Tools\windows\Tests\GdiplusStartup.Live.Tests.ps1 with pinned Zig and Winghostty -> process remained alive but no native window appeared; observations=80; exact 11 keys
GREEN: pwsh -NoProfile -File Tools\windows\Tests\GdiplusStartup.Live.Tests.ps1 with pinned Zig and Winghostty -> PASS; executed=1; observations=2; native window appeared
REGRESSION: pwsh -NoProfile -File Tools\windows\validate.ps1 -Task windows-shell -SkipTrayLive -ShellValidationRoot C:\v7 -> PASS; Windows shell 53/53, App 739/739, scrubbed startup 4/4
zig test src\GdiplusAA.zigwith pinned Zig: 1/1 passed.Tools\windows\Tests\ValidationRunner.Tests.ps1: passed, including 380multi-project protocol contracts.
cases with developer-tool paths excluded.
GdiplusStartupandGdiplusShutdownmay run ondifferent threads when GDI+ objects are gone before shutdown. Shutdown is
therefore invoked only after the message loop, while the mutex prevents
overlap with active draw sessions.
package, release, backend, Worktrees, Nod, dump, or publication action is
included here.
make testandmake checkwere not run because this change is scopedto the Windows Zig shell and Windows validation.
Checklist
git commit -s) per the DCOmake test)make check)