Skip to content

Commit

Permalink
chore: Adjust for arraypool possible leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban authored Nov 26, 2024
1 parent 58714bb commit 0627818
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Uno.UWP/UI/Core/WeakEventHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ public void Invoke(object sender, object? args)

for (int i = 0; i < count; i++)
{
handlers[i].Handler(sender, args);
ref var handler = ref handlers[i];

handler.Handler(sender, args);

// Clear the handle immediately, so we don't
// call ArrayPool.Return with clear.
handler = null;
}

ArrayPool<WeakHandler>.Shared.Return(handlers);
Expand Down

0 comments on commit 0627818

Please sign in to comment.