From a6869fbc3ef92733de37f6dc95d62f08034dae17 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Aug 2010 15:33:42 +0100 Subject: Use SOP.ParentGroup in Prioritizer instead of Scene.GetGroupByPrim() By the time a scheduled update is triggered, a sog may have been removed from the scene. This change prevents NullReferenceExceptions in these situations. --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index de3c360..505d01f 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -122,9 +122,16 @@ namespace OpenSim.Region.Framework.Scenes // Use group position for child prims Vector3 entityPos; if (entity is SceneObjectPart) - entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + { + // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene + // before its scheduled update was triggered + //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + } else + { entityPos = entity.AbsolutePosition; + } return Vector3.DistanceSquared(presencePos, entityPos); } @@ -144,9 +151,16 @@ namespace OpenSim.Region.Framework.Scenes // Use group position for child prims Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) - entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + { + // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene + // before its scheduled update was triggered + //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + } else + { entityPos = entity.AbsolutePosition; + } if (!presence.IsChildAgent) { -- cgit v1.1 From df702417dc6aba6422b3f252023ea551620f8ee2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Aug 2010 16:27:41 +0100 Subject: Remove mono compiler warnings --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 3 +-- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ------------ .../Region/Framework/Scenes/SceneCommunicationService.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 -- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 ++-------------- .../Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 +-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 - 7 files changed, 7 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 505d01f..272f718 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Scenes public class Prioritizer { - private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the @@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes break; default: throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); - break; } // Adjust priority so that root prims are sent to the viewer first. This is especially important for diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1f4d022..5fe944d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3608,18 +3608,6 @@ namespace OpenSim.Region.Framework.Scenes return true; } - private ILandObject GetParcelAtPoint(float x, float y) - { - foreach (var parcel in AllParcels()) - { - if (parcel.ContainsPoint((int)x,(int)y)) - { - return parcel; - } - } - return null; - } - /// /// Update an AgentCircuitData object with new information /// diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c675322..88e084e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// A user will arrive shortly, set up appropriate credentials so it can connect /// - public event ExpectUserDelegate OnExpectUser; +// public event ExpectUserDelegate OnExpectUser; /// /// A Prim will arrive shortly @@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// A new prim has arrived /// - public event PrimCrossing OnPrimCrossingIntoRegion; +// public event PrimCrossing OnPrimCrossingIntoRegion; ///// ///// A New Region is up and available @@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// We have a child agent for this avatar and we're getting a status update about it /// - public event ChildAgentUpdate OnChildAgentUpdate; +// public event ChildAgentUpdate OnChildAgentUpdate; //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; /// diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1da4287..5b4ec3b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1700,8 +1700,6 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart newRoot = newSet[0]; newSet.RemoveAt(0); - List linkIDs = new List(); - foreach (SceneObjectPart newChild in newSet) newChild.UpdateFlag = 0; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2ad4223..3ed74e1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4727,20 +4727,8 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.IsDeleted) return; - Vector3 lPos = OffsetPosition; - - if (IsAttachment) - { - if (ParentGroup.RootPart != this) - return; - - lPos = ParentGroup.RootPart.AttachedPos; - } - else - { - if (ParentGroup.RootPart == this) - lPos = AbsolutePosition; - } + if (IsAttachment && ParentGroup.RootPart != this) + return; // Causes this thread to dig into the Client Thread Data. // Remember your locking here! diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index e08fa77..d7767bd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -576,8 +576,7 @@ namespace OpenSim.Region.Framework.Scenes } public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) - { - UUID ownerID = item.OwnerID; + { AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); if (null == rezAsset) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 08c6e27..a4eae42 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2327,7 +2327,6 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = Util.EnvironmentTickCount(); PhysicsActor actor = m_physicsActor; - Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; Vector3 pos = m_pos; pos.Z += m_appearance.HipOffset; -- cgit v1.1 From f3f4428700f2c63901e6f068957f879143ba0bd5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Aug 2010 21:50:19 +0100 Subject: refactor: break out attachment position change code in Scene.UpdatePrimPosition() and move into AttachmentsModule This allows region modules to change attachment positions. --- .../Framework/Interfaces/IAttachmentsModule.cs | 8 +++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 37 ++++++++-------------- 2 files changed, 21 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 2af2548..05c1e00 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -131,5 +131,13 @@ namespace OpenSim.Region.Framework.Interfaces /// A /// void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); + + /// + /// Update the position of an attachment + /// + /// + /// + /// + void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5b4ec3b..9db2691 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1289,37 +1289,21 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) + public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(localID); + if (group != null) - { - - // Vector3 oldPos = group.AbsolutePosition; + { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { - - // If this is an attachment, then we need to save the modified - // object back into the avatar's inventory. First we save the - // attachment point information, then we update the relative - // positioning (which caused this method to get driven in the - // first place. Then we have to mark the object as NOT an - // attachment. This is necessary in order to correctly save - // and retrieve GroupPosition information for the attachment. - // Then we save the asset back into the appropriate inventory - // entry. Finally, we restore the object's attachment status. - - byte attachmentPoint = group.GetAttachmentPoint(); - group.UpdateGroupPosition(pos); - group.RootPart.IsAttachment = false; - group.AbsolutePosition = group.RootPart.AttachedPos; - m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); - group.SetAttachmentPoint(attachmentPoint); - + if (m_parentScene.AttachmentsModule != null) + m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos); } else { - if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) + if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) + && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) { group.UpdateGroupPosition(pos); } @@ -1328,14 +1312,19 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update the texture entry of the given prim. /// + /// + /// A texture entry is an object that contains details of all the textures of the prim's face. In this case, + /// the texture is given in its byte serialized form. + /// /// /// /// protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(localID); + if (group != null) { if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) -- cgit v1.1 From 2b0f924557575777511432e5d72d21297a8002fd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Aug 2010 22:09:52 +0100 Subject: refactor: Move Scene.Inventory.UpdateKnownItem() into Attachments module since this appears to relate solely to attachments --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 47 ---------------------- 1 file changed, 47 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 379128a..8ed8b96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1799,53 +1799,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) - { - SceneObjectGroup objectGroup = grp; - if (objectGroup != null) - { - if (!grp.HasGroupChanged) - { - m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID); - return; - } - - m_log.InfoFormat( - "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", - grp.UUID, grp.GetAttachmentPoint()); - - string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); - - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); - - if (item != null) - { - AssetBase asset = CreateAsset( - objectGroup.GetPartName(objectGroup.LocalId), - objectGroup.GetPartDescription(objectGroup.LocalId), - (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml), - remoteClient.AgentId); - AssetService.Store(asset); - - item.AssetID = asset.FullID; - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; - item.InvType = (int)InventoryType.Object; - - InventoryService.UpdateItem(item); - - // this gets called when the agent loggs off! - if (remoteClient != null) - { - remoteClient.SendInventoryItemCreateUpdate(item, 0); - } - } - } - } - public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) { itemID = UUID.Zero; -- cgit v1.1 From 7f5501d3ab20f986317828c8c41783d64770f7a7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Aug 2010 22:13:31 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a4eae42..fbb3177 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2326,14 +2326,15 @@ namespace OpenSim.Region.Framework.Scenes { m_perfMonMS = Util.EnvironmentTickCount(); - PhysicsActor actor = m_physicsActor; - Vector3 pos = m_pos; pos.Z += m_appearance.HipOffset; //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); - remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + remoteClient.SendPrimUpdate( + this, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentUpdates(1); -- cgit v1.1 From 1c0b4457cdcd543f04bc818a987f6e3f2311098d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 28 Aug 2010 00:40:33 +0100 Subject: Improve liveness by operating on list copies of SOG.Children where appropriate --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 22 +++++----- .../Framework/Scenes/Scene.PacketHandlers.cs | 15 ++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 21 ++++----- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 51 +++++++++++----------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 50 +++++++++++---------- 5 files changed, 84 insertions(+), 75 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8ed8b96..2ac46e2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2004,11 +2004,12 @@ namespace OpenSim.Region.Framework.Scenes sog.SetGroup(groupID, remoteClient); sog.ScheduleGroupForFullUpdate(); + List partList = null; lock (sog.Children) - { - foreach (SceneObjectPart child in sog.Children.Values) - child.Inventory.ChangeInventoryOwner(ownerID); - } + partList = new List(sog.Children.Values); + + foreach (SceneObjectPart child in partList) + child.Inventory.ChangeInventoryOwner(ownerID); } else { @@ -2017,14 +2018,15 @@ namespace OpenSim.Region.Framework.Scenes if (sog.GroupID != groupID) continue; - + + List partList = null; lock (sog.Children) + partList = new List(sog.Children.Values); + + foreach (SceneObjectPart child in partList) { - foreach (SceneObjectPart child in sog.Children.Values) - { - child.LastOwnerID = child.OwnerID; - child.Inventory.ChangeInventoryOwner(groupID); - } + child.LastOwnerID = child.OwnerID; + child.Inventory.ChangeInventoryOwner(groupID); } sog.SetOwnerId(groupID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 9f1575d..c511774 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -164,16 +164,17 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup sog = ent as SceneObjectGroup; + List partList = null; lock (sog.Children) + partList = new List(sog.Children.Values); + + foreach (SceneObjectPart part in partList) { - foreach (KeyValuePair child in (sog.Children)) + if (part.LocalId == primLocalID) { - if (child.Value.LocalId == primLocalID) - { - child.Value.GetProperties(remoteClient); - foundPrim = true; - break; - } + part.GetProperties(remoteClient); + foundPrim = true; + break; } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5fe944d..db081cc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2065,19 +2065,20 @@ namespace OpenSim.Region.Framework.Scenes group.RemoveScriptInstances(true); } + List partList = null; lock (group.Children) + partList = new List(group.Children.Values); + + foreach (SceneObjectPart part in partList) { - foreach (SceneObjectPart part in group.Children.Values) + if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) { - if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) - { - PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? - } - else if (part.PhysActor != null) - { - PhysicsScene.RemovePrim(part.PhysActor); - part.PhysActor = null; - } + PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? + } + else if (part.PhysActor != null) + { + PhysicsScene.RemovePrim(part.PhysActor); + part.PhysActor = null; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 9db2691..2c242c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -380,34 +380,35 @@ namespace OpenSim.Region.Framework.Scenes part.Shape.Scale = scale; } } + + m_numPrim += sceneObject.Children.Count; + } - sceneObject.AttachToScene(m_parentScene); + sceneObject.AttachToScene(m_parentScene); - if (sendClientUpdates) - sceneObject.ScheduleGroupForFullUpdate(); - - Entities.Add(sceneObject); - m_numPrim += sceneObject.Children.Count; - - if (attachToBackup) - sceneObject.AttachToBackup(); - - if (OnObjectCreate != null) - OnObjectCreate(sceneObject); + if (sendClientUpdates) + sceneObject.ScheduleGroupForFullUpdate(); + + Entities.Add(sceneObject); + + if (attachToBackup) + sceneObject.AttachToBackup(); + + if (OnObjectCreate != null) + OnObjectCreate(sceneObject); + + lock (SceneObjectGroupsByFullID) + { + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByFullID[part.UUID] = sceneObject; + } - lock (SceneObjectGroupsByFullID) - { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; - } - - lock (SceneObjectGroupsByLocalID) - { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; - } + lock (SceneObjectGroupsByLocalID) + { + SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fc5eeed..40a8f83 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -237,6 +237,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// The parts of this scene object group. You must lock this property before using it. + /// If you're doing anything other than reading values, please take a copy of the values rather than locking + /// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock /// If you want to know the number of children, consider using the PrimCount property instead /// public Dictionary Children @@ -1968,28 +1970,29 @@ namespace OpenSim.Region.Framework.Scenes //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) // return; - lock (m_parts) - { - bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); + bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); - if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) - { - m_rootPart.UpdateFlag = 1; - lastPhysGroupPos = AbsolutePosition; - } + if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) + { + m_rootPart.UpdateFlag = 1; + lastPhysGroupPos = AbsolutePosition; + } - if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) - { - m_rootPart.UpdateFlag = 1; - lastPhysGroupRot = GroupRotation; - } + if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) + { + m_rootPart.UpdateFlag = 1; + lastPhysGroupRot = GroupRotation; + } - foreach (SceneObjectPart part in m_parts.Values) - { - if (!IsSelected) - part.UpdateLookAt(); - part.SendScheduledUpdates(); - } + List partList = null; + lock (m_parts) + partList = new List(m_parts.Values); + + foreach (SceneObjectPart part in partList) + { + if (!IsSelected) + part.UpdateLookAt(); + part.SendScheduledUpdates(); } } @@ -2787,11 +2790,12 @@ namespace OpenSim.Region.Framework.Scenes public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF) { + List partList = null; lock (m_parts) - { - foreach (SceneObjectPart part in m_parts.Values) - part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); - } + partList = new List(m_parts.Values); + + foreach (SceneObjectPart part in partList) + part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); HasGroupChanged = true; } -- cgit v1.1 From 0a83fde85c8cffa1da46ef0a17390399ae74fa61 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 29 Aug 2010 21:28:31 -0400 Subject: Implements parcel media setting persistence and packet / CAPS handling properly for the new media settings. Signed-off-by: Melanie --- OpenSim/Region/Framework/Interfaces/IEventQueue.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index e093f0a..81e4952 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs @@ -28,6 +28,7 @@ using System.Net; using OpenMetaverse; using OpenMetaverse.Packets; +using OpenMetaverse.Messages.Linden; using OpenMetaverse.StructuredData; namespace OpenSim.Region.Framework.Interfaces @@ -54,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute); - void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID); + void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); } } -- cgit v1.1