From 14ee3f16a1c1b7c5f561c307b956f769c5e89474 Mon Sep 17 00:00:00 2001 From: Rob Bertels Date: Wed, 25 Sep 2024 15:11:34 +0200 Subject: [PATCH] ImGui memory leak fix (#2284) * Start of ImGui leak fix * Dispose of MouseState at end of UpdateImGuiInput --- .../Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs index ad1125287b..6eafd99393 100644 --- a/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs +++ b/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs @@ -251,7 +251,7 @@ private void UpdateImGuiInput() { var io = ImGuiNET.ImGui.GetIO(); - var mouseState = _input.Mice[0].CaptureState(); + using var mouseState = _input.Mice[0].CaptureState(); io.MouseDown[0] = mouseState.IsButtonPressed(MouseButton.Left); io.MouseDown[1] = mouseState.IsButtonPressed(MouseButton.Right);