From da0c8b2b7ccc15349eb0654c8232e0947e37ecc3 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 2 Feb 2023 16:46:56 +0100 Subject: [PATCH] tests/vulkan: fix bug when VK_KHR_surface is missing We call vkDestroySurfaceKHR indiscriminately, even if VK_KHR_surface was not even enabled. (Since it's listed under `opt_extensions`, this is a valid case) Easiest way to work around this special case is to just avoid calling vkDestroySurfaceKHR if we never created a surface, since in that case `surf` will still be NULL. --- src/tests/vulkan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/vulkan.c b/src/tests/vulkan.c index c5cc9e0f..581f1251 100644 --- a/src/tests/vulkan.c +++ b/src/tests/vulkan.c @@ -287,7 +287,8 @@ int main() pl_log_level_update(log, PL_LOG_INFO); } - vkDestroySurfaceKHR(inst->instance, surf, NULL); + if (surf) + vkDestroySurfaceKHR(inst->instance, surf, NULL); pl_vk_inst_destroy(&inst); pl_log_destroy(&log); free(devices);