mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #1758] test: d3d12test::Ref owns its pointer alone: move only, and ref = {} releases (TEST-REF-MOVE-ONLY) #1771
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1771
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1758
Author: @adrianmjim
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:test/ref-move-only📝 Commits (1)
a8a56cbtest: d3d12test::Ref owns its pointer alone: move only, andref = {}releases (TEST-REF-MOVE-ONLY)📊 Changes
1 file changed (+13 additions, -0 deletions)
View changed files
📝
runtime/test/d3d12_test_shaders.h(+13 -0)📄 Description
Claimed in the coordination issue as: TEST-REF-MOVE-ONLY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161001857)
What and why
d3d12test::Ref(runtime/test/d3d12_test_shaders.h, included directly by 40 test sources and 3 shared test headers) had a destructor but no copy or move members of its own. Two consequences:ref = {}silently leaked. It builds an empty temporary and copies its null pointer over the held one, soRelease()is never called. That is what happened in #1558's new test: its slot 133 resource stayed alive and kept the device proxy and the whole D3D12 device. UnderLEONIDA_VK_VALIDATION=1the result was a 63-objectvkDestroyDevicereport, which I first misread as a runtime leak.std::vector<Ref<...>>that grows copies every element and then destroys the originals.d3d12_bundle_testkeepsRefs in vectors (Rig::bundle_allocators,Rig::bundles). EachRigcallsbundle()once, so neither grows past its first element, and the bug is latent.The change: copying is deleted, moving transfers the pointer, and move assignment releases the old pointer. So
ref = {}now does what it reads as, and a growing vector moves (noexcept). The struct keeps itspmember,reset()andoperator->, and no test copies aRefor initialises one from a pointer, so every test builds unchanged.Tested
On
main2b567edcawith this change, Windows 11 build 26300, VS 2022 (MSVC 19.44) RelWithDebInfo, AMD Radeon RX 7900 XT, driver 32.0.32029.2010 (26.11.2):ctest -j 6: 400 of 403 without failures (387 passed, 13 skipped). The three failures are the same as onmain42537e7b6without it:d3d12_texture_tiles(#964),d3d12_clear, andd3d12_geometry_views(#1678, no Resizable BAR).placed.reset()(whatplaced = {}does after this change) left no leaked objects under validation.GPUs tested: AMD Radeon RX 7900 XT (RDNA3), AMD 32.0.32029.2010, Windows 11 26300
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.