Skip to content

Commit

Permalink
fix null handles in vkDestroy* functions
Browse files Browse the repository at this point in the history
Fixes #205
  • Loading branch information
DadSchoorse committed Mar 2, 2023
1 parent 48728ce commit 44e0b7e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/basalt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 44e0b7e

Please sign in to comment.