XGameRuntime: avoid leaking Mount handles in mount_with_ui_async #1242
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1242
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1242"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@b3IKK on GitHub · 2026-11-24 13:39 UTC · original
b3IKK:xgameruntime/mount-with-ui-async-leak→main· +54 −7 · 2 files · 1 commits · openmount_with_ui_asynccalledXPackageMount(allocatingBox<Mount>) beforebegin_withvalidated theXAsyncBlockor scheduled work. Ifbwas null (E_INVALIDARG) or its task queue was already terminated (E_ABORT), the allocatedMounthandle was never returned to the caller and leaked permanently.This copies the optional package identifier and performs
XPackageMountinside thebegin_withwork closure soMountis only allocated when the async work runs.What is in it
crates/xcl/src/hle/xgameruntime/api.rs: moveXPackageMountinside thebegin_withwork closure inmount_with_ui_async; add unit testmount_with_ui_async_does_not_leak_mount_on_invalid_or_aborted_call.crates/xcl/src/hle/xgameruntime/mod.rs: add#[cfg(test)]LIVE_MOUNTScounter inXPackageMount/XPackageCloseMountHandlefor the leak test.This is now the only PR from this account that changes
mount_with_ui_async: the mount part was taken out of #1610 (#1607, group D68), so the two do not compete for the same lines.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 994 passed, 0 failed, 45 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- mount_with_ui_async: 1 passed, 0 failed. Withmount_with_ui_asyncput back tomain's version and the test kept: 0 passed, 1 failed —Mount leaked on null XAsyncBlock.Regression run
main (
80f4819, clean tree, no local changes):PR (
7124d1e, clean tree, no local changes):Not tested
mount_with_ui_asyncwith a terminated queue (the test builds that call)AI use
xgameruntime/api.rs, wrote the fix and the regression test (and confirmed it fails with the old function), rebased onto80f4819, ran the test suite and thescripts/smoke.ps1runs, and drafted this PR description.github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@dcastell1 on GitHub · 2026-11-24 13:45 UTC · original
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@930e8b4(baseline 751 passed, 0 failed, 41 ignored on this box):One more than the baseline; the XGameRuntime mount-handle leak fix is exercised and green.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@b3IKK on GitHub · 2026-11-25 00:14 UTC · original
Rebased onto
80f4819(mainhad added a test at the same place inapi.rs; both are kept) and re-ran: 994 passed, 0 failed, 45 ignored. This is now the only PR from this account that changesmount_with_ui_async: #1610 no longer does. Againstmain's function the test fails withMount leaked on null XAsyncBlock. AI use: OpenCode, Claude Fable 5.2.@DavidM1911 on GitHub · 2026-11-26 04:32 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.