From 8fc557cc6e987578ece80335ba3aaadb9119b1ad Mon Sep 17 00:00:00 2001 From: der richter Date: Sat, 13 Jul 2024 14:10:04 +0200 Subject: [PATCH] mac/vulkan: error out on context creation without an NSApplication if no NSApplication has been initialized, applications using Appkit functionality are not supposed to work properly or just deadlock indefinitely. properly error out on macvk context creation in that case. --- video/out/vulkan/context_mac.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video/out/vulkan/context_mac.m b/video/out/vulkan/context_mac.m index 66093dd110..ee07226b38 100644 --- a/video/out/vulkan/context_mac.m +++ b/video/out/vulkan/context_mac.m @@ -56,6 +56,11 @@ static bool mac_vk_init(struct ra_ctx *ctx) struct mpvk_ctx *vk = &p->vk; int msgl = ctx->opts.probing ? MSGL_V : MSGL_ERR; + if (!NSApp) { + MP_ERR(ctx, "Failed to initialize macvk context, no NSApplication initialized.\n"); + goto error; + } + if (!mpvk_init(vk, ctx, VK_EXT_METAL_SURFACE_EXTENSION_NAME)) goto error;