From e6f92044caa8f66fd0a04019b9edcd30eb389920 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 20 Nov 2008 00:13:15 +0000 Subject: From: Christopher Yeoh Attached is a patch which fixes mantis bug 2645 where scripts in child prims freeze after being unlinked from the root prim. This got introduced some time after the 0.6 freeze. Have checked test suites pass even after nant clean ;-) http://opensimulator.org/mantis/bug_update_page.php?bug_id=2645 Also removes a redundant ResetIDs call Regards, Chris --- OpenSim/Region/Environment/Scenes/SceneGraph.cs | 1 - OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 10 ++++++---- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index ab0ec1f..18fe151 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs @@ -1669,7 +1669,6 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID, true); copy.AbsolutePosition = copy.AbsolutePosition + offset; - copy.ResetIDs(); lock (Entities) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2d62d66..82ab4eb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -591,17 +591,19 @@ namespace OpenSim.Region.Environment.Scenes { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; - + m_rootPart.ParentID = 0; - m_rootPart.LocalId = m_scene.AllocateLocalId(); + if (m_rootPart.LocalId==0) + m_rootPart.LocalId = m_scene.AllocateLocalId(); + // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_parts.Values) { if (Object.ReferenceEquals(part, m_rootPart)) continue; - - part.LocalId = m_scene.AllocateLocalId(); + if (part.LocalId==0) + part.LocalId = m_scene.AllocateLocalId(); part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index a626fa3..96ee169 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1223,7 +1223,6 @@ if (m_shape != null) { if (userExposed) dupe.UUID = UUID.Random(); - dupe.LocalId = localID; dupe._ownerID = AgentID; dupe._groupID = GroupID; dupe.GroupPosition = GroupPosition; @@ -1245,6 +1244,8 @@ if (m_shape != null) { if (userExposed) dupe.ResetIDs(linkNum); + // Move afterwards ResetIDs as it clears the localID + dupe.LocalId = localID; // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. dupe._lastOwnerID = ObjectOwner; @@ -1927,6 +1928,7 @@ if (m_shape != null) { { UUID = UUID.Random(); LinkNum = linkNum; + LocalId = 0; ResetInventoryIDs(); } -- cgit v1.1