From 758d2df9c1a78bf172d46f0a40db816a881a28a9 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 12 Feb 2020 11:44:39 -0500 Subject: Added missing synchronization in GetHashCode --- csharp/src/Ice/IPEndpointI.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'csharp/src') diff --git a/csharp/src/Ice/IPEndpointI.cs b/csharp/src/Ice/IPEndpointI.cs index d04b5d91d54..3d3c280f6b7 100644 --- a/csharp/src/Ice/IPEndpointI.cs +++ b/csharp/src/Ice/IPEndpointI.cs @@ -243,14 +243,17 @@ namespace IceInternal public override int GetHashCode() { - if(!_hashInitialized) + lock (this) { - _hashValue = 5381; - HashUtil.hashAdd(ref _hashValue, type()); - hashInit(ref _hashValue); - _hashInitialized = true; + if(!_hashInitialized) + { + _hashValue = 5381; + HashUtil.hashAdd(ref _hashValue, type()); + hashInit(ref _hashValue); + _hashInitialized = true; + } + return _hashValue; } - return _hashValue; } public override int CompareTo(EndpointI obj) -- cgit v1.2.3