vulkan/overlay: fix crash on destroying NULL swapchain
authorPavel Asyutchenko <sventeam@yandex.ru>
Tue, 23 Jun 2020 20:10:38 +0000 (23:10 +0300)
committerMarge Bot <eric+marge@anholt.net>
Thu, 25 Jun 2020 10:31:50 +0000 (10:31 +0000)
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5616>

src/vulkan/overlay-layer/overlay.cpp

index 1ed1d2b02e7882fed1d8485ee6de955772d8f069..c415d6a82059b2133ed4f37b35659018f58d8a7d 100644 (file)
@@ -1861,6 +1861,12 @@ static void overlay_DestroySwapchainKHR(
     VkSwapchainKHR                              swapchain,
     const VkAllocationCallbacks*                pAllocator)
 {
+   if (swapchain == VK_NULL_HANDLE) {
+      struct device_data *device_data = FIND(struct device_data, device);
+      device_data->vtable.DestroySwapchainKHR(device, swapchain, pAllocator);
+      return;
+   }
+
    struct swapchain_data *swapchain_data =
       FIND(struct swapchain_data, swapchain);