1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-02-02 12:37:20 +01:00

Backends: Metal: Fixed resource leak when using multiple contexts. (#7419)

This commit is contained in:
ocornut 2025-01-06 15:01:59 +01:00
parent 2f1194a296
commit d0021e1621
2 changed files with 5 additions and 7 deletions

View File

@ -306,17 +306,14 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* drawData, id<MTLCommandBuffer> c
indexBufferOffset += (size_t)draw_list->IdxBuffer.Size * sizeof(ImDrawIdx);
}
__block MetalContext* sharedMetalContext = bd->SharedMetalContext;
[commandBuffer addCompletedHandler:^(id<MTLCommandBuffer>)
{
dispatch_async(dispatch_get_main_queue(), ^{
ImGui_ImplMetal_Data* bd = ImGui_ImplMetal_GetBackendData();
if (bd != nullptr)
{
@synchronized(bd->SharedMetalContext.bufferCache)
{
[bd->SharedMetalContext.bufferCache addObject:vertexBuffer];
[bd->SharedMetalContext.bufferCache addObject:indexBuffer];
}
[sharedMetalContext.bufferCache addObject:vertexBuffer];
[sharedMetalContext.bufferCache addObject:indexBuffer];
}
});
}];

View File

@ -64,6 +64,7 @@ Other changes:
- Misc: Fixed misc/cpp/imgui_stdlib.h/.cpp not supporting IMGUI_DISABLE. (#8294) [@juur]
- Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears
to leak on on X11 (#8256). [@Helodity]
- Backends: Metal: Fixed resource leak when using multiple contexts. (#7419) [@anszom]
- Backends: Vulkan: Fixed setting VkSwapchainCreateInfoKHR::preTransform for
platforms not supporting VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR. (#8222) [@Zer0xFF]