remove silly double locking

0.9.1.0-post-fixes
UbitUmarov 2018-12-28 21:12:19 +00:00
parent 8d28c94879
commit 00278f7258
1 changed files with 10 additions and 12 deletions

View File

@ -5468,15 +5468,19 @@ namespace OpenSim.Region.Framework.Scenes
// this scales bad but so does GetLinkNumPart // this scales bad but so does GetLinkNumPart
public int GetLinkNumber(string name) public int GetLinkNumber(string name)
{ {
if(String.IsNullOrEmpty(name) || name == "Object") if(String.IsNullOrEmpty(name) || name == "Object" || name == "Primitive")
return -1; return -1;
lock(m_partsNameToLinkMap) lock(m_partsNameToLinkMap)
{ {
if(m_partsNameToLinkMap.Count == 0) if (name == GetLinkNumber_lastname)
return GetLinkNumber_lastnumber;
if (m_partsNameToLinkMap.Count == 0)
{ {
GetLinkNumber_lastname = String.Empty; GetLinkNumber_lastname = String.Empty;
GetLinkNumber_lastnumber = -1; GetLinkNumber_lastnumber = -1;
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
@ -5495,19 +5499,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if(name == GetLinkNumber_lastname)
return GetLinkNumber_lastnumber;
if(m_partsNameToLinkMap.ContainsKey(name)) if(m_partsNameToLinkMap.ContainsKey(name))
{ {
lock(m_partsNameToLinkMap) GetLinkNumber_lastname = name;
{ GetLinkNumber_lastnumber = m_partsNameToLinkMap[name];
GetLinkNumber_lastname = name; return GetLinkNumber_lastnumber;
GetLinkNumber_lastnumber = m_partsNameToLinkMap[name];
return GetLinkNumber_lastnumber;
}
} }
} }
if(m_sittingAvatars.Count > 0) if(m_sittingAvatars.Count > 0)
{ {