iOS: Fix use-after-free when Vulkan init fails

viewDidLoad deleted the graphics context on InitAPI failure but left the member
pointing at the freed object, and then kept going - runVulkanRenderLoop and
shutdown would both use it. Null it out instead; both already check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZk5y4Fzw811WJoNWZb8Sc
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-08-06 20:56:37 +02:00
1 parent 6aad668a38
commit 89f7094513
1 file changed
+3 -1
+3 -1
View File
@@ -206,7 +206,9 @@ static void VulkanRenderLoop(GraphicsContext *graphicsContext, CAMetalLayer *met
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
SetGPUBackend(GPUBackend::OPENGL);
delete graphicsContext;
// TODO: What to do here?
graphicsContext = nullptr; // The render loop and shutdown check for this.
// TODO: What to do here? We've switched the config over to GL, but we're still the Metal view controller,
// so we won't render anything until the app gets restarted.
}
[self updateResolutionWithView:self.view];