From 7f765fc0a4f778c36a67326fb0bac36c2d468bae Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 17 Apr 2024 01:58:11 -0500 Subject: [PATCH] try fixing leak --- extern/imgui_patched/backends/imgui_impl_metal.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extern/imgui_patched/backends/imgui_impl_metal.mm b/extern/imgui_patched/backends/imgui_impl_metal.mm index 930806dfa..1480c5026 100644 --- a/extern/imgui_patched/backends/imgui_impl_metal.mm +++ b/extern/imgui_patched/backends/imgui_impl_metal.mm @@ -164,6 +164,9 @@ bool ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor* renderPassDescriptor) { ImGui_ImplMetal_Data* bd = ImGui_ImplMetal_GetBackendData(); IM_ASSERT(bd->SharedMetalContext != nil && "No Metal context. Did you call ImGui_ImplMetal_Init() ?"); + if (bd->SharedMetalContext.framebufferDescriptor != nil) { + [bd->SharedMetalContext.framebufferDescriptor release]; + } bd->SharedMetalContext.framebufferDescriptor = [[FramebufferDescriptor alloc] initWithRenderPassDescriptor:renderPassDescriptor]; if (bd->SharedMetalContext.depthStencilState == nil) @@ -233,6 +236,7 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* drawData, id c id renderPipelineState = ctx.renderPipelineStateCache[ctx.framebufferDescriptor]; if (renderPipelineState == nil) { + printf("RPS NULL....\n"); // No luck; make a new render pipeline state renderPipelineState = [ctx renderPipelineStateForFramebufferDescriptor:ctx.framebufferDescriptor device:commandBuffer.device];