[Mesa-dev] [PATCH 1/2] vulkan/wsi: don't crash on null swapchain

Arda Coskunses acoskunses at gmail.com
Thu Dec 22 17:30:49 UTC 2016


When application window closed unexpectedly
anv_GetSwapchainImagesKHR function getting
called with invlid parameters which cause a
crash. Necessary Null check added
---
 src/intel/vulkan/anv_wsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 669eacc..1e05daf 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -320,6 +320,9 @@ VkResult anv_GetSwapchainImagesKHR(
 {
    ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
 
+   if(!swapchain)
+      return VK_INCOMPLETE;
+
    return swapchain->get_images(swapchain, pSwapchainImageCount,
                                 pSwapchainImages);
 }
-- 
2.7.4



More information about the mesa-dev mailing list