Skip to content

D3D12.X: clear the preparation screen when the presentation window is missing - #2845

Draft
oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-2839-preparation-state-leak
Draft

oni-swr wants to merge 1 commit into
xcl-dev:mainfrom
oni-swr:t3/xcl-2839-preparation-state-leak

Conversation

@oni-swr

@oni-swr oni-swr commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

preparation::before_guest installed SCREEN and set ACTIVE, then returned early with ? when ensure_window() timed out, leaving both set. This installs the screen and acquires the window in a small activate() helper that clears both again when no window comes back. The normal path (READY handoff, window creation order) is unchanged.

Fixes #2839

What is in it

  • crates/xcl/src/hle/d3d12x/present/preparation.rs: activate() helper used by before_guest; two unit tests (window missing clears ACTIVE/SCREEN; window acquired keeps them).

Tested

  • CPU only, no GPU used. Windows 11 x64, debug build.
  • cargo check --workspace --tests -j 4: finished, no errors.
  • cargo test -p xcl --lib -j 4 preparation: 6 passed, 0 failed, 0 ignored.
  • With the cleanup disabled, a_missing_window_leaves_no_active_screen fails (5 passed, 1 failed).

Regression run

  • Pending: the GPU is not available to me right now. The main and head xcl-smoke blocks will be added when it is.

Not tested

  • The full suite on a GPU (cargo test --workspace -- --test-threads=4) and the paired scripts/smoke.ps1 runs are pending a free RX 7800 XT. The real 3 s ensure_window() timeout was not triggered.

AI use

  • Claude Code (Claude Sonnet 5.5): wrote the change, the tests and this description.

🤖 Generated with Claude Code

… missing

before_guest installed SCREEN and set ACTIVE, then returned early with `?` when
ensure_window() timed out (3 s). Neither was reset, so the window procedure kept
routing messages to a preparation screen that nobody was running.

Install the screen and acquire the window in activate(), which clears both again
when no window comes back. The normal path is unchanged.

Fixes xcl-dev#2839

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@andrewDoing

Copy link
Copy Markdown

I exercised the real ensure_window() timeout with the repository synthetic title on parent 8b957bec6f82495aec940944c6bf47faa02db590 and head 76b17593f75f0908ccef09f7423a99f8579e561c. Identical test-only instrumentation delayed the window-owner thread five seconds; the production three-second deadline and error path were unchanged.

Revision Elapsed ACTIVE SCREEN Outcome
Parent 3,005 ms true Some window error, exit 2
Head 3,001 ms false None window error, exit 2

With the delay disabled, both revisions left ACTIVE false and SCREEN empty, and the synthetic guest exited successfully with zero failures. This validates timeout cleanup and its normal-path control, not retail-title behavior.

AI use: OpenAI Codex with GPT-6.2 Astra instrumented and ran the synthetic comparisons; Codex coordinated and prepared this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3D12.X: preparation::run leaks ACTIVE/SCREEN state if ensure_window() times out

2 participants