Repository navigation
fix: crash on window close from double-release of shader blobs - #5
Merged
Merged
Conversation
The context destructor explicitly Release()d each ID3DBlob and then shader_blobs.clear() ran the unique_ptr default deleter, which called delete on the already-released (destroyed) COM objects, crashing the process. Use a custom deleter for the shader blob vector that calls ID3DBlob::Release(), and drop the explicit release loop.
igagis-bot
force-pushed
the
fix-window-close-crash
branch
from
December 2, 2026 18:10
a2ee865 to
416f600
Compare
igagis
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the DirectX app crash on closing a new window (see cppfw/ruisapp#44).
Root cause
ruis::render::directx::contextstores the HLSL shader blobs (created byD3DCompile) in astd::vector<std::unique_ptr<ID3DBlob>>.In the destructor, each blob was explicitly
Release()d, thenshader_blobs.clear()ran theunique_ptr's default deleter, which calleddeleteon the already-released (and possibly destroyed) COM objects. Closing a window triggered this teardown path, crashing the process (exit code 3221226356 / access violation).Fix
Use a custom deleter for the shader blob vector that calls
ID3DBlob::Release(), and drop the explicit release loop in the destructor. The vector's elements now release the COM object exactly once, in the correct order (pipelines first, then blobs).Verification
Reproduced the crash on
ruisapp-directx-test(create a new window via the probe, close it with WM_CLOSE):windows_count{1}), the app stays alive