From 2b092ca38757c1462fd6f8f06aa3b194e9bd7b75 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Sun, 6 Mar 2022 22:27:00 -0800 Subject: [PATCH] fix swapchain framebuffer leak on exit --- src/Refresh_Driver_Vulkan.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 14242fe..3a71ea6 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -4556,6 +4556,15 @@ static void VULKAN_DestroyDevice( VULKAN_Wait(device->driverData); + for (i = renderer->swapchainDataCount - 1; i >= 0; i -= 1) + { + VULKAN_INTERNAL_DestroySwapchain(renderer, renderer->swapchainDatas[i]->windowHandle); + } + + SDL_free(renderer->swapchainDatas); + + VULKAN_Wait(device->driverData); + SDL_free(renderer->submittedCommandBuffers); VULKAN_INTERNAL_DestroyBuffer(renderer, renderer->dummyVertexUniformBuffer->vulkanBuffer); @@ -4715,13 +4724,6 @@ static void VULKAN_DestroyDevice( VULKAN_INTERNAL_DestroyUniformBufferPool(renderer, renderer->fragmentUniformBufferPool); VULKAN_INTERNAL_DestroyUniformBufferPool(renderer, renderer->computeUniformBufferPool); - for (i = renderer->swapchainDataCount - 1; i >= 0; i -= 1) - { - VULKAN_INTERNAL_DestroySwapchain(renderer, renderer->swapchainDatas[i]->windowHandle); - } - - SDL_free(renderer->swapchainDatas); - for (i = 0; i < renderer->framebufferHashArray.count; i += 1) { VULKAN_INTERNAL_DestroyFramebuffer(