From 44e0b7ef31c1ec9565508289e74199ea2702d6b1 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Thu, 2 Mar 2023 20:15:55 +0100 Subject: [PATCH] fix null handles in vkDestroy* functions Fixes https://github.com/DadSchoorse/vkBasalt/issues/205 --- src/basalt.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/basalt.cpp b/src/basalt.cpp index 7e539f1..8061050 100644 --- a/src/basalt.cpp +++ b/src/basalt.cpp @@ -141,6 +141,9 @@ namespace vkBasalt void VKAPI_CALL vkBasalt_DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) { + if (!instance) + return; + scoped_lock l(globalLock); Logger::trace("vkDestroyInstance"); @@ -291,6 +294,9 @@ namespace vkBasalt void VKAPI_CALL vkBasalt_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) { + if (!device) + return; + scoped_lock l(globalLock); Logger::trace("vkDestroyDevice"); @@ -605,6 +611,9 @@ namespace vkBasalt VKAPI_ATTR void VKAPI_CALL vkBasalt_DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) { + if (!swapchain) + return; + scoped_lock l(globalLock); // we need to delete the infos of the oldswapchain @@ -699,6 +708,9 @@ namespace vkBasalt VKAPI_ATTR void VKAPI_CALL vkBasalt_DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) { + if (!image) + return; + scoped_lock l(globalLock); LogicalDevice* pLogicalDevice = deviceMap[GetKey(device)].get();