Fixed crash on wayland exit (#352)

The engine would crash on exit because SDL handles the deletion of the swapchain on his own, making the engine delete the swapchain twice, which would result in a crash on wayland.
This fix checks if the Video Subsystem is not running any more, if not it will assume there is no need to destroy the swap chains any more.
This commit is contained in:
Matteo De Carlo
2021-11-09 17:59:08 +01:00
committed by GitHub
parent 1cf8585d37
commit e70ede130d
+9 -2
View File
@@ -924,8 +924,15 @@ namespace Vulkan_Internal
vkDestroyFramebuffer(allocationhandler->device, swapChainFramebuffers[i], nullptr);
vkDestroyImageView(allocationhandler->device, swapChainImageViews[i], nullptr);
}
vkDestroySwapchainKHR(allocationhandler->device, swapChain, nullptr);
vkDestroySurfaceKHR(allocationhandler->instance, surface, nullptr);
#ifdef SDL2
// Checks if the SDL VIDEO System was already destroyed.
// If so we would delete the swapchain twice, causing a crash on wayland.
if (SDL_WasInit(SDL_INIT_VIDEO))
#endif
{
vkDestroySwapchainKHR(allocationhandler->device, swapChain, nullptr);
vkDestroySurfaceKHR(allocationhandler->instance, surface, nullptr);
}
vkDestroySemaphore(allocationhandler->device, swapchainAcquireSemaphore, nullptr);
vkDestroySemaphore(allocationhandler->device, swapchainReleaseSemaphore, nullptr);