diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7ca7caa6e8..596286edc0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4866,10 +4866,20 @@ namespace OpenSim.Region.Framework.Scenes
/// Get a copy of the list of sitting avatars.
///
/// This applies to all sitting avatars whether there is a sit target set or not.
- ///
+ /// A hashset of the sitting avatars. Returns null if there are no sitting avatars.
public HashSet GetSittingAvatars()
{
- return new HashSet(m_sittingAvatars);
+ HashSet sittingAvatars = m_sittingAvatars;
+
+ if (sittingAvatars == null)
+ {
+ return null;
+ }
+ else
+ {
+ lock (sittingAvatars)
+ return new HashSet(sittingAvatars);
+ }
}
///
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index ed39be1fec..493ab70883 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
@@ -69,6 +70,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
+ Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
+ Assert.That(part.GetSittingAvatars(), Is.Null);
Assert.That(m_sp.ParentID, Is.EqualTo(0));
}
@@ -86,7 +89,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
+ Assert.That(m_sp.PhysicsActor, Is.Null);
+
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
+ Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
+ HashSet sittingAvatars = part.GetSittingAvatars();
+ Assert.That(sittingAvatars.Count, Is.EqualTo(1));
+ Assert.That(sittingAvatars.Contains(m_sp.UUID));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
}
@@ -104,10 +113,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
- Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
- Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
- Assert.That(m_sp.PhysicsActor, Is.Null);
-
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
@@ -119,6 +124,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_sp.StandUp();
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
+ Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
+ Assert.That(part.GetSittingAvatars(), Is.Null);
Assert.That(m_sp.ParentID, Is.EqualTo(0));
Assert.That(m_sp.PhysicsActor, Is.Not.Null);
}
@@ -145,11 +152,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
Assert.That(m_sp.PhysicsActor, Is.Null);
+ Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
+ HashSet sittingAvatars = part.GetSittingAvatars();
+ Assert.That(sittingAvatars.Count, Is.EqualTo(1));
+ Assert.That(sittingAvatars.Contains(m_sp.UUID));
+
m_sp.StandUp();
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(0));
Assert.That(m_sp.PhysicsActor, Is.Not.Null);
+
+ Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
+ Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
+ Assert.That(part.GetSittingAvatars(), Is.Null);
}
[Test]
diff --git a/prebuild.xml b/prebuild.xml
index 1c9e736ce8..cd72147f25 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3038,6 +3038,7 @@
../../../bin/
+