From e8f41a679b1452268cace0604de75189aa7a0421 Mon Sep 17 00:00:00 2001 From: Dmytro Ivanov Date: Thu, 9 Feb 2023 14:00:29 +0100 Subject: [PATCH] FIX: Closing profiler marker properly (#1631) --- Packages/com.unity.inputsystem/CHANGELOG.md | 4 ++++ .../InputSystem/Utilities/DelegateHelpers.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 88ad57418e..36548dfd48 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,6 +10,10 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] +### Fixed + +- Fixed unclosed profiler marker in `InvokeCallbacksSafe_AnyCallbackReturnsTrue` which would lead to eventually broken profiler traces in some cases like using `PlayerInput` (case ISXB-393). + ## [1.5.0] - 2023-01-24 ### Added diff --git a/Packages/com.unity.inputsystem/InputSystem/Utilities/DelegateHelpers.cs b/Packages/com.unity.inputsystem/InputSystem/Utilities/DelegateHelpers.cs index b0c57d1282..ef4d443360 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Utilities/DelegateHelpers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Utilities/DelegateHelpers.cs @@ -95,7 +95,11 @@ public static bool InvokeCallbacksSafe_AnyCallbackReturnsTrue( try { if (callbacks[i](argument1, argument2)) + { + callbacks.UnlockForChanges(); + Profiler.EndSample(); return true; + } } catch (Exception exception) {