From e8e0d7fa20f8c20a389c9a4702844bf5b52633ed Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 20 Jul 2025 22:11:02 -0400 Subject: [PATCH] [vk] tmp: workaround for RAII crash on exit Prevent double-free Signed-off-by: crueter --- src/video_core/vulkan_common/vulkan_wrapper.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index c703abe40e..40136c3fbf 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp @@ -11,6 +11,7 @@ #include #include "common/common_types.h" +#include "common/settings.h" #include "common/logging/log.h" #include "video_core/vulkan_common/vk_enum_string_helper.h" #include "video_core/vulkan_common/vma.h" @@ -309,7 +310,10 @@ const char* Exception::what() const noexcept { } void Destroy(VkInstance instance, const InstanceDispatch& dld) noexcept { - dld.vkDestroyInstance(instance, nullptr); + // FIXME: A double free occurs here if RAII is enabled. + if (!Settings::values.enable_raii.GetValue()) { + dld.vkDestroyInstance(instance, nullptr); + } } void Destroy(VkDevice device, const InstanceDispatch& dld) noexcept { @@ -412,7 +416,10 @@ void Destroy(VkInstance instance, VkDebugReportCallbackEXT handle, } void Destroy(VkInstance instance, VkSurfaceKHR handle, const InstanceDispatch& dld) noexcept { - dld.vkDestroySurfaceKHR(instance, handle, nullptr); + // FIXME: A double free occurs here if RAII is enabled. + if (!Settings::values.enable_raii.GetValue()) { + dld.vkDestroySurfaceKHR(instance, handle, nullptr); + } } VkResult Free(VkDevice device, VkDescriptorPool handle, Span sets,