Added missing mutex lock in VmaDefragmentationContext_T::DefragmentPassEnd As proposed by @JustSid in https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/issues/313
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index ae2c984..3934de3 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h
@@ -12377,7 +12377,11 @@ { case VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY: { - uint8_t mapCount = move.srcAllocation->SwapBlockAllocation(vector->m_hAllocator, move.dstTmpAllocation); + uint8_t mapCount = 0; + { + VmaMutexLockWrite swapLock(vector->GetMutex(), vector->GetAllocator()->m_UseMutex); + mapCount = move.srcAllocation->SwapBlockAllocation(vector->m_hAllocator, move.dstTmpAllocation); + } if (mapCount > 0) { allocator = vector->m_hAllocator;