From 0b5dcbb53377f189ddd66f3b7027b3400644efb3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 15 Jul 2026 22:58:54 +0200 Subject: [PATCH] Fix `Array::ClearDelete` on Clang --- Source/Engine/Core/Collections/Array.h | 5 +---- Source/Engine/Core/Memory/AllocationUtils.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/Engine/Core/Collections/Array.h b/Source/Engine/Core/Collections/Array.h index 919ff8f80..dff1e4c6a 100644 --- a/Source/Engine/Core/Collections/Array.h +++ b/Source/Engine/Core/Collections/Array.h @@ -370,10 +370,7 @@ public: { T* data = Get(); for (int32 i = 0; i < _count; i++) - { - if (data[i]) - Delete(data[i]); - } + AllocationUtils::DeleteHelper(data[i]); Clear(); } diff --git a/Source/Engine/Core/Memory/AllocationUtils.h b/Source/Engine/Core/Memory/AllocationUtils.h index 802deacad..41b95c6ee 100644 --- a/Source/Engine/Core/Memory/AllocationUtils.h +++ b/Source/Engine/Core/Memory/AllocationUtils.h @@ -21,4 +21,18 @@ namespace AllocationUtils from.Free(); } } + + template + static typename TEnableIf::Value>::Type DeleteHelper(T& ptr) + { + if (ptr) + { + Memory::DestructItem(ptr); + Allocator::Free(ptr); + } + } + template + static typename TEnableIf::Value>::Type DeleteHelper(T& ptr) + { + } }