diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-28 01:50:40 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-28 01:50:40 +0100 |
| commit | 1c5a9fb7b8c704a59ec58894adf46d73d1615072 (patch) | |
| tree | 532ffc9738624cbce23ecdea51c8b94aae4f4b77 /src/gpu/sequence.cc | |
| parent | 75e561bd092895a031ae4475f7d1fdc35b1b1832 (diff) | |
fix: double-free of external views in NodeRegistry and PASSTHROUGH shader test
- NodeRegistry: skip external nodes (texture==nullptr) in ~NodeRegistry()
and resize() to avoid double-releasing views set via set_external_view()
- test_shader_assets: update PASSTHROUGH check to match #include pattern
handoff(Claude): 35/35 tests passing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/sequence.cc')
| -rw-r--r-- | src/gpu/sequence.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc index 9de4133..783f3df 100644 --- a/src/gpu/sequence.cc +++ b/src/gpu/sequence.cc @@ -30,15 +30,14 @@ NodeRegistry::NodeRegistry(WGPUDevice device, int default_width, NodeRegistry::~NodeRegistry() { for (auto& [name, node] : nodes_) { + if (node.texture == nullptr) continue; // External view, not owned if (node.view) { wgpuTextureViewRelease(node.view); } for (auto& mip_view : node.mip_views) { wgpuTextureViewRelease(mip_view); } - if (node.texture) { - wgpuTextureRelease(node.texture); - } + wgpuTextureRelease(node.texture); } } @@ -108,6 +107,7 @@ void NodeRegistry::resize(int width, int height) { default_height_ = height; for (auto& [name, node] : nodes_) { + if (node.texture == nullptr) continue; // External view, not owned // Release old texture if (node.view) { wgpuTextureViewRelease(node.view); @@ -115,9 +115,7 @@ void NodeRegistry::resize(int width, int height) { for (auto& mip_view : node.mip_views) { wgpuTextureViewRelease(mip_view); } - if (node.texture) { - wgpuTextureRelease(node.texture); - } + wgpuTextureRelease(node.texture); // Recreate with new dimensions node.width = width; |
