From 2eaa6d5ace738cf1848f82ce7a0b435928b6846f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 9 Jul 2012 21:24:32 +0100
Subject: Do not allow a script to attach a prim if its being sat upon.
This prevents a stack overflow where a get position on the avatar will refer to the attachment which will in turn refer back to the avatar.
This required recording of all sitting avatars on a prim which is done separately from recording the sit target avatar.
Recording HashSet is null if there are no sitting avatars in order to save memory.
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4e0e183..fc04761 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3401,6 +3401,20 @@ namespace OpenSim.Region.Framework.Scenes
return count;
}
+ ///
+ /// Gets the number of sitting avatars.
+ ///
+ /// This applies to all sitting avatars whether there is a sit target set or not.
+ ///
+ public int GetSittingAvatarsCount()
+ {
+ int count = 0;
+
+ Array.ForEach(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
+
+ return count;
+ }
+
public override string ToString()
{
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
--
cgit v1.1