From 9e1ee2f29055204d07dd54a2b8f92ca16215095e Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Fri, 18 Oct 2024 16:42:14 -0400 Subject: [PATCH] Fix potential crash when a descriptor set is destroyed but not unbound (#8215) --- filament/backend/CMakeLists.txt | 2 ++ filament/backend/src/metal/MetalState.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt index 29a580924bb..3878723f434 100644 --- a/filament/backend/CMakeLists.txt +++ b/filament/backend/CMakeLists.txt @@ -540,6 +540,8 @@ if (APPLE AND NOT IOS) add_executable(metal_utils_test test/MetalTest.mm) +target_compile_options(metal_utils_test PRIVATE "-fobjc-arc") + target_link_libraries(metal_utils_test PRIVATE backend getopt diff --git a/filament/backend/src/metal/MetalState.h b/filament/backend/src/metal/MetalState.h index 1e14cddc258..3948c78aec9 100644 --- a/filament/backend/src/metal/MetalState.h +++ b/filament/backend/src/metal/MetalState.h @@ -434,7 +434,7 @@ class MetalBufferBindings { private: static_assert(N <= 8); - std::array<__unsafe_unretained id, N> mBuffers = { nil }; + std::array<__weak id, N> mBuffers = { nil }; std::array mOffsets = { 0 }; utils::bitset8 mDirtyBuffers; utils::bitset8 mDirtyOffsets;