diff options
Diffstat (limited to 'layers/swapchain.cpp')
| -rw-r--r-- | layers/swapchain.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index 47e4fe83..f16e4fa6 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -997,6 +997,13 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance insta it != pSurface->swapchains.end() ; it++) { // Delete all SwpImage's it->second->images.clear(); + // In case the swapchain's device hasn't been destroyed yet + // (which isn't likely, but is possible), delete its + // association with this swapchain (i.e. so we can't point to + // this swpchain from that device, later on): + if (it->second->pDevice) { + it->second->pDevice->swapchains.clear(); + } } pSurface->swapchains.clear(); } @@ -1118,6 +1125,13 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, cons it != pDevice->swapchains.end() ; it++) { // Delete all SwpImage's it->second->images.clear(); + // In case the swapchain's surface hasn't been destroyed yet + // (which is likely) delete its association with this swapchain + // (i.e. so we can't point to this swpchain from that surface, + // later on): + if (it->second->pSurface) { + it->second->pSurface->swapchains.clear(); + } } pDevice->swapchains.clear(); } @@ -1864,6 +1878,9 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( __FUNCTION__); } } + if (pSwapchain->pSurface) { + pSwapchain->pSurface->swapchains.erase(swapchain); + } if (pSwapchain->imageCount) { pSwapchain->images.clear(); } |
