test: check the range's QueryInterface contract #1724
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1731"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T17:55:35Z.
What
src/d3d12_xs_range.cppimplementsQueryInterfaceas:The device-free check never calls it on the range object, so both halves can be removed without a failure. Two mutations,
each rebuilt and reverted:
The second one is the reason the case seeds the output with a sentinel before each call: a refusal that leaves the pointer
alone is a caller-visible bug even though the HRESULT is right.
Change
Four assertions after the range is created:
IX2WGpuRangeandIUnknownreturn the range,ID3D12Deviceis refused withE_NOINTERFACEand a cleared output, and a null output isE_POINTER.That pair of releases is not decoration: without it the fixture fails later, because the counted windows and the
live_windowsaccounting assume the range holds exactly the references it took. Worth knowing for anyone extending thisblock.
Tested
Scope
One test file, no behaviour change. This is the second of the three unwitnessed guards in
create/the range object from#1727; the remaining one is the window-count limit, which I do not think can be witnessed — the
UINTbound rejects acount long before
windows_.max_size()could fire, so that second comparison is unreachable and its mutation isequivalent. I am not going to add a case that cannot distinguish anything.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:04:12Z.
Review: COMMENTED
Reviewed commit
50625c8ca5955097765ce742e4ecd89e7d8e4752.One formatting defect to fix before merging:
tests/d3d12_xs_range_check.cpp:212): Please add a newline between}andexpect(...).Optional tightening (non-blocking):
Release()calls (expect(range->Release() == 2 && range->Release() == 1, ...)) would catch a missingAddRef()inQueryInterfacecleanly as a test failure instead of hitting use-after-free on the secondRelease().Local verification
git diff --check,docs_links_check.py,bidi_controls_check.py): PASS--preset dev):cmake --build --preset dev --target d3d12_xs_range_check -- -j 6+ctest --preset dev -R '^(d3d12_xs_range|d3d12_xs_range_full_last_window_control)$' --parallel 4 --no-tests=error --output-on-failure-> 2/2 passed/O2(--preset release):cmake --build --preset release --target d3d12_xs_range_check -- -j 6+ctest --preset release -R '^(d3d12_xs_range|d3d12_xs_range_full_last_window_control)$' --parallel 4 --no-tests=error --output-on-failure-> 2/2 passedAI-assisted; commands listed were executed locally.