Browse Source

Merge pull request #3056 from MarchingCube/perf-misc

Fix small perf issue in WeakEventHandleManager
pull/3060/head
Nikita Tsukanov 7 years ago
committed by GitHub
parent
commit
1475e1c07c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs

8
src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs

@ -142,10 +142,12 @@ namespace Avalonia.Utilities
_data = ndata;
}
MethodInfo method = s.Method;
var subscriber = (TSubscriber)s.Target;
if (!s_Callers.TryGetValue(s.Method, out var caller))
s_Callers[s.Method] = caller =
(CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, s.Method);
if (!s_Callers.TryGetValue(method, out var caller))
s_Callers[method] = caller =
(CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, method);
_data[_count] = new Descriptor
{
Caller = caller,

Loading…
Cancel
Save