From: Arda Coskunses Date: Thu, 22 Dec 2016 21:55:03 +0000 (-0700) Subject: vulkan/wsi/x11: don't crash on null visual X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01dd363e671ac3a457bc3ff60b43b04e108c33fc;p=mesa.git vulkan/wsi/x11: don't crash on null visual When application window closed unexpectedly due to lost window visualtypes getting invlaid parameters which is causing a crash. Necessary check is added to prevent the crash. Reviewed-by: Jason Ekstrand Cc: "13.0" --- diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 25ba0c1b8ae..037aa50ba2a 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -349,6 +349,9 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface, xcb_visualtype_t *visual = get_visualtype_for_window(conn, window, &visual_depth); + if (!visual) + return VK_ERROR_SURFACE_LOST_KHR; + geom = xcb_get_geometry_reply(conn, geom_cookie, &err); if (geom) { VkExtent2D extent = { geom->width, geom->height };