summaryrefslogtreecommitdiff
path: root/packaging/0014-Fix-inconsistency-between-GetHasCode-and-Equals-1351.patch
blob: 0de7bc3f503d5ab7519140082acfbca298fa249c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 6b2a3ed5103ca11bb928ccf94b6b50bfdbb3d115 Mon Sep 17 00:00:00 2001
From: Jonghyun Park <parjong@gmail.com>
Date: Wed, 23 Aug 2017 05:56:01 +0900
Subject: [PATCH 14/23] Fix inconsistency between GetHasCode and Equals
 (#13513)

---
 src/mscorlib/src/System/MulticastDelegate.cs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mscorlib/src/System/MulticastDelegate.cs b/src/mscorlib/src/System/MulticastDelegate.cs
index 988bf2b..1d701f0 100644
--- a/src/mscorlib/src/System/MulticastDelegate.cs
+++ b/src/mscorlib/src/System/MulticastDelegate.cs
@@ -452,6 +452,17 @@ namespace System
             if (IsUnmanagedFunctionPtr())
                 return ValueType.GetHashCodeOfPtr(_methodPtr) ^ ValueType.GetHashCodeOfPtr(_methodPtrAux);
 
+            if (_invocationCount != (IntPtr)0)
+            {
+                var t = _invocationList as Delegate;
+
+                if (t != null)
+                {
+                    // this is a secure/wrapper delegate so we need to unwrap and check the inner one
+                    return t.GetHashCode();
+                }
+            }
+
             Object[] invocationList = _invocationList as Object[];
             if (invocationList == null)
             {
-- 
1.9.1