From 1bf076c74f634236f7b6728e85d5b4b39466b5ac Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 31 Dec 2024 15:10:55 +1000 Subject: [PATCH] VulkanDevice: Fix crash on shutdown if swapchain creation fails --- src/util/vulkan_device.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index b10eaaab80..a462cf4968 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -1995,7 +1995,10 @@ bool VulkanDevice::CreateDeviceAndMainSwapChain(std::string_view adapter, Featur swap_chain = std::make_unique(wi, vsync_mode, allow_present_throttle, exclusive_fullscreen_control); if (!swap_chain->CreateSurface(m_instance, m_physical_device, error)) + { + swap_chain->Destroy(*this, false); return false; + } } // Attempt to create the device.