mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminating option to return the actual list. Callers can now either request a copy of the array as a new List or ask the SceneGraph to call a delegate function on every ScenePresence. Iteration and locking of the ScenePresences now takes place only within the SceneGraph class.
This patch also applies a fix to Combat/CombatModule.cs which had unlocked iteration of the ScenePresences and inconsistent try/catch around the use of those ScenePresences.
This commit is contained in:
@@ -414,12 +414,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ForEachCurrentScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < scenePresences.Length; i++)
|
||||
scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
{
|
||||
ScenePresence scenePresence = scenePresences[i];
|
||||
|
||||
if (!scenePresence.IsChildAgent)
|
||||
{
|
||||
m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
|
||||
@@ -429,7 +425,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -441,14 +437,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ForEachCurrentScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < scenePresences.Length; i++)
|
||||
scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
{
|
||||
ScenePresence scenePresence = scenePresences[i];
|
||||
if (!scenePresence.IsChildAgent)
|
||||
avatars.Add(scenePresence);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -461,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
ForEachCurrentScene(delegate(Scene scene)
|
||||
{
|
||||
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
||||
presences.AddRange(scenePresences);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user