From 53187e2d930cf982a0bc7f99262586c6a8a0640a Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 21 Feb 2026 10:02:22 +0100 Subject: test: fix test_effect_base intermittent crashes and SIGTRAP - Fix stack-use-after-scope dangling reference by storing mutable GpuContext in WebGPUTestFixture. - Fix wgpuDevicePoll causing SIGTRAP and replace with target.read_pixels() to block for GPU teardown safely. - Fix WGPUCommandEncoder leak. --- src/tests/common/webgpu_test_fixture.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/tests/common/webgpu_test_fixture.h') diff --git a/src/tests/common/webgpu_test_fixture.h b/src/tests/common/webgpu_test_fixture.h index e10a2ed..fa23587 100644 --- a/src/tests/common/webgpu_test_fixture.h +++ b/src/tests/common/webgpu_test_fixture.h @@ -34,8 +34,9 @@ class WebGPUTestFixture { WGPUTextureFormat format() const { return WGPUTextureFormat_BGRA8Unorm; } - GpuContext ctx() const { - return {device_, queue_, format()}; + const GpuContext& ctx() const { + ctx_ = {device_, queue_, format()}; + return ctx_; } // Check if fixture is ready @@ -48,6 +49,7 @@ class WebGPUTestFixture { WGPUAdapter adapter_ = nullptr; WGPUDevice device_ = nullptr; WGPUQueue queue_ = nullptr; + mutable GpuContext ctx_ = {}; // Callback state for async device request struct RequestState { -- cgit v1.2.3