Use EnumerateInvocationList instead of GetInvocationList (#2303)

This commit is contained in:
srkizer 2025-06-24 05:09:48 +09:00 committed by GitHub
parent 13306e24ba
commit 03e728e129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 402 additions and 294 deletions

View file

@ -79,13 +79,16 @@ internal abstract class FontHandle : IFontHandle
/// <param name="font">The font, locked during the call of <see cref="ImFontChanged"/>.</param>
public void InvokeImFontChanged(ILockedImFont font)
{
try
foreach (var d in Delegate.EnumerateInvocationList(this.ImFontChanged))
{
this.ImFontChanged?.Invoke(this, font);
}
catch (Exception e)
{
Log.Error(e, $"{nameof(this.InvokeImFontChanged)}: error");
try
{
d(this, font);
}
catch (Exception e)
{
Log.Error(e, $"{nameof(this.InvokeImFontChanged)}: error calling {d.Method.Name}");
}
}
}