From 6e9afff7ba0e75294bb0eeee029eff98169ec9a0 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 c861cd8cfc9..92d5a3319c2 100644 --- a/filament/backend/src/metal/MetalState.h +++ b/filament/backend/src/metal/MetalState.h @@ -442,7 +442,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;