From 9e297cd7228e56255039929f710e52a0590c74e4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 7 Jan 2009 19:33:20 +0000 Subject: * Slightly increase ScenePresences locking where it's technically required in SceneGraph --- OpenSim/Region/Environment/Scenes/SceneGraph.cs | 42 +++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index 26fe40a..be2fb46 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs @@ -837,7 +837,11 @@ namespace OpenSim.Region.Environment.Scenes protected internal ScenePresence GetScenePresence(UUID agentID) { ScenePresence sp; - ScenePresences.TryGetValue(agentID, out sp); + + lock (ScenePresences) + { + ScenePresences.TryGetValue(agentID, out sp); + } return sp; } @@ -968,22 +972,26 @@ namespace OpenSim.Region.Environment.Scenes protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) { ScenePresence presence; - if (ScenePresences.TryGetValue(avatarId, out presence)) + + lock (ScenePresences) { - avatar = presence; - return true; + if (ScenePresences.TryGetValue(avatarId, out presence)) + { + avatar = presence; + return true; - //if (!presence.IsChildAgent) - //{ - // avatar = presence; - // return true; - //} - //else - //{ - // m_log.WarnFormat( - // "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!", - // avatarId, m_parentScene.RegionInfo.RegionName); - //} + //if (!presence.IsChildAgent) + //{ + // avatar = presence; + // return true; + //} + //else + //{ + // m_log.WarnFormat( + // "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!", + // avatarId, m_parentScene.RegionInfo.RegionName); + //} + } } avatar = null; @@ -1477,13 +1485,13 @@ namespace OpenSim.Region.Environment.Scenes // We need to explicitly resend the newly link prim's object properties since no other actions // occur on link to invoke this elsewhere (such as object selection) - parenPrim.RootPart.AddFlag(PrimFlags.CreateSelected); + parenPrim.RootPart.AddFlag(PrimFlags.CreateSelected); parenPrim.TriggerScriptChangedEvent(Changed.LINK); if (client != null) parenPrim.GetProperties(client); else { - foreach (ScenePresence p in ScenePresences.Values) + foreach (ScenePresence p in GetScenePresences()) { parenPrim.GetProperties(p.ControllingClient); } -- cgit v1.1