From 844d96f0551da4e2111c8ff9de2b76de83600445 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 May 2016 17:35:26 -0700 Subject: [PATCH] Vulkan: Free allocator safely on exit. --- GPU/Vulkan/TextureCacheVulkan.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index ca20481862..ccf2fefee6 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -147,7 +147,12 @@ TextureCacheVulkan::TextureCacheVulkan(VulkanContext *vulkan) TextureCacheVulkan::~TextureCacheVulkan() { Clear(true); allocator_->Destroy(); - delete allocator_; + + // We have to delete on queue, so this can free its queued deletions. + vulkan_->Delete().QueueCallback([](void *ptr) { + auto allocator = static_cast(ptr); + delete allocator; + }, allocator_); } void TextureCacheVulkan::DownloadFramebufferForClut(u32 clutAddr, u32 bytes) {