aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-26 21:06:47 +0100
committerJustin Clark-Casey (justincc)2012-06-26 21:06:47 +0100
commit4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1 (patch)
treebaeb059111b289ffcdbd3911f2995b1f0d38b9c2
parentAdd much easier ConsoleDisplayTable AddColumn() and AddRow() methods. (diff)
downloadopensim-SC-4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1.zip
opensim-SC-4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1.tar.gz
opensim-SC-4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1.tar.bz2
opensim-SC-4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1.tar.xz
If crossing attachments into another region pre-fatpack, clone objects before changing properties to avoid hud display race condition with update threads.
This matches behaviour in fatpack crossing, where attachments are cloned before their properties are changed. This only applies to crossings to simulators running code released before April 2011.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs43
1 files changed, 26 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7d82060..f5ebe97 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1666,6 +1666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1666 #endregion 1666 #endregion
1667 1667
1668 #region Object Transfers 1668 #region Object Transfers
1669
1669 /// <summary> 1670 /// <summary>
1670 /// Move the given scene object into a new region depending on which region its absolute position has moved 1671 /// Move the given scene object into a new region depending on which region its absolute position has moved
1671 /// into. 1672 /// into.
@@ -1967,35 +1968,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1967 return successYN; 1968 return successYN;
1968 } 1969 }
1969 1970
1970 protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) 1971 /// <summary>
1972 /// Cross the attachments for an avatar into the destination region.
1973 /// </summary>
1974 /// <remarks>
1975 /// This is only invoked for simulators released prior to April 2011. Versions of OpenSimulator since then
1976 /// transfer attachments in one go as part of the ChildAgentDataUpdate data passed in the update agent call.
1977 /// </remarks>
1978 /// <param name='destination'></param>
1979 /// <param name='sp'></param>
1980 /// <param name='silent'></param>
1981 protected void CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
1971 { 1982 {
1972 List<SceneObjectGroup> m_attachments = sp.GetAttachments(); 1983 List<SceneObjectGroup> attachments = sp.GetAttachments();
1973 1984
1974 // Validate 1985// m_log.DebugFormat(
1975// foreach (SceneObjectGroup gobj in m_attachments) 1986// "[ENTITY TRANSFER MODULE]: Crossing {0} attachments into {1} for {2}",
1976// { 1987// m_attachments.Count, destination.RegionName, sp.Name);
1977// if (gobj == null || gobj.IsDeleted)
1978// return false;
1979// }
1980 1988
1981 foreach (SceneObjectGroup gobj in m_attachments) 1989 foreach (SceneObjectGroup gobj in attachments)
1982 { 1990 {
1983 // If the prim group is null then something must have happened to it! 1991 // If the prim group is null then something must have happened to it!
1984 if (gobj != null && !gobj.IsDeleted) 1992 if (gobj != null && !gobj.IsDeleted)
1985 { 1993 {
1986 // Set the parent localID to 0 so it transfers over properly. 1994 SceneObjectGroup clone = (SceneObjectGroup)gobj.CloneForNewScene();
1987 gobj.RootPart.SetParentLocalId(0); 1995 clone.RootPart.GroupPosition = gobj.RootPart.AttachedPos;
1988 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 1996 clone.IsAttachment = false;
1989 gobj.IsAttachment = false; 1997
1990 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 1998 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1991 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); 1999 m_log.DebugFormat(
1992 CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent); 2000 "[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}",
2001 clone.UUID, destination.RegionName);
2002
2003 CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, clone, silent);
1993 } 2004 }
1994 } 2005 }
1995 2006
1996 sp.ClearAttachments(); 2007 sp.ClearAttachments();
1997
1998 return true;
1999 } 2008 }
2000 2009
2001 #endregion 2010 #endregion