Examples: Metal: Wrap main event loop body in an @autoreleasepool block to ensure allocations get freed even if underlying system event loop gets paused due to app nap (#2910, #2917)

docking
Max Thrun 5 years ago committed by omar
parent 8342e5b91a
commit 6d9a54a904

@ -37,6 +37,8 @@ Other Changes:
- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups] - Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
- Backends: GLFW, SDL, Win32, OSX, Allegro: Added support for ImGuiMouseCursor_NotAllowed. [@rokups] - Backends: GLFW, SDL, Win32, OSX, Allegro: Added support for ImGuiMouseCursor_NotAllowed. [@rokups]
- Backends: GLFW: Added support for the missing mouse cursors newly added in GLFW 3.4+. [@rokups] - Backends: GLFW: Added support for the missing mouse cursors newly added in GLFW 3.4+. [@rokups]
- Examples: Metal: Wrapped main loop in @autoreleasepool block to ensure allocations get freed
even if underlying system event loop gets paused due to app nap (#2910, #2917). [@bear24rw]
----------------------------------------------------------------------- -----------------------------------------------------------------------

@ -81,6 +81,8 @@ int main(int, char**)
// Main loop // Main loop
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{
@autoreleasepool
{ {
// Poll and handle events (inputs, window resize, etc.) // Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
@ -154,6 +156,7 @@ int main(int, char**)
[commandBuffer presentDrawable:drawable]; [commandBuffer presentDrawable:drawable];
[commandBuffer commit]; [commandBuffer commit];
} }
}
// Cleanup // Cleanup
ImGui_ImplMetal_Shutdown(); ImGui_ImplMetal_Shutdown();

Loading…
Cancel
Save