From dfa19e23f03643762a10677203c088161a99557e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 8 Feb 2012 21:58:59 +0000 Subject: Stop a scene object from attempting to link with itself (which results in an exception and constant complaints in v3 viewers). Aims to address http://opensimulator.org/mantis/view.php?id=5878 --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 7d801b5..693a79e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1662,6 +1662,10 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroup child = children[i].ParentGroup; + // Don't try and add a group to itself - this will only cause severe problems later on. + if (child == parentGroup) + continue; + // Make sure no child prim is set for sale // So that, on delink, no prims are unwittingly // left for sale and sold off @@ -1684,11 +1688,13 @@ namespace OpenSim.Region.Framework.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) - parentGroup.RootPart.CreateSelected = true; - parentGroup.TriggerScriptChangedEvent(Changed.LINK); - parentGroup.HasGroupChanged = true; - parentGroup.ScheduleGroupForFullUpdate(); - + if (childGroups.Count > 0) + { + parentGroup.RootPart.CreateSelected = true; + parentGroup.TriggerScriptChangedEvent(Changed.LINK); + parentGroup.HasGroupChanged = true; + parentGroup.ScheduleGroupForFullUpdate(); + } } finally { -- cgit v1.1