Skip to content

Exit with the real exit code on Windows - #47

Merged
chrislaupama merged 4 commits into
mainfrom
windows-exit-code
Nov 12, 2026
Merged

chrislaupama merged 4 commits into
mainfrom
windows-exit-code

Conversation

@chrislaupama

Copy link
Copy Markdown
Collaborator

What

Closes #40. On Windows the app exited with 0x87A instead of 0 after a passing screenshot or self-test run, so CI could not check the exit code there.

What the probe showed

A diagnostic run on the hosted Windows runner (WARP, DX12; #45, now closed) ran the app in several variants and printed each exit code:

Variant Exit code
exit before anything is created 0x00000000
screenshot, --no-audio 0x0000087A
10 frames, no screenshot 0x0000087A
10 frames, no screenshot, --no-audio 0x0000087A
offscreen screenshot 0x0000087A
std::process::exit(0) after run() returned 0x0000087A
TerminateProcess(…, 0) after run() returned 0x00000000

So run() returns Ok every time, and the audio backend, the screenshot and frame presentation are not involved. The code is replaced after main hands control to the normal process exit, while DLLs unload, and only once the window (and with it the wgpu device, which Slint keeps in a thread-local backend) has existed. 0x87A is the DXGI facility number, which points at the graphics stack's own shutdown. Which DLL does it has not been pinned down, and it has only been seen with WARP; a real GPU still needs checking on a Windows machine.

The fix

Once run() has returned, everything of ours is already closed (project, settings, engine), so on Windows main flushes stdout and stderr and ends the process directly with its real code (exit_now). Other systems exit as before. A failure inside run(), or a crash while it tears down, still gives a non-zero code.

CI now fails the Windows screenshot and self-test steps on a non-zero exit code, and the release smoke test does the same for the installed app. engine/README.md describes the cause as far as it is known in place of "not yet explained".

This branch also carries the GCC 15 build fix from #41 so the Linux job can pass.

Screenshots

No visual change.

Benchmarks

No change to anything that runs while the app is open; process exit on Windows skips DLL unloading and is, if anything, faster.

Docs

  • README.md is still accurate
  • engine/README.md updated

Generated by Claude Code

The hosted Linux runner moved to Ubuntu 26.04, whose GCC 15 reports
-Wnull-dereference (an error in CI) in three files:

- Copies of file-scope default vectors written through operator[]: GCC
  can't see that a dynamically initialised global is non-empty. Use .at()
  for those writes in test_mod_routes.cpp and bench_devices.cpp.
- memcpy from an empty vector's data() in bench_devices.cpp: skip the
  copy when there is nothing to copy (memcpy from null is undefined even
  for zero bytes).
- sorted.back() on a possibly empty timing vector in bench_render.cpp:
  guard it the way run_render already does.
After any run that opened the window, a normal process exit on Windows
reported 0x87A instead of 0: the code is replaced after main returns,
while the process unloads its DLLs (same with or without audio, a
screenshot or presented frames; an exit before the window exists is 0).
The app now ends its process directly once run() has returned, and CI and
the release smoke test check the exit code on Windows too.
@chrislaupama chrislaupama self-assigned this Nov 12, 2026
@chrislaupama
chrislaupama marked this pull request as ready for review November 12, 2026 03:53
@chrislaupama
chrislaupama merged commit f24be7a into main Nov 12, 2026
25 checks passed
@chrislaupama
chrislaupama deleted the windows-exit-code branch November 12, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find out why the app exits with 0x87A on Windows after a passing self-test

1 participant