Fix bug where crossing to a neighbouring region and back again would trigger an exception, and a second recross would stop the user moving until relog

Also fixes an issue where sitting avatar counts became inaccurate after any cross.
Part of the problem was due to cloning code using MemberwiseClone() but not resetting certain collection structures.
Adds regression test for this case.
In relation to http://opensimulator.org/mantis/view.php?id=7050
This commit is contained in:
Justin Clark-Casey (justincc)
2014-04-03 00:19:53 +01:00
parent 2051535ce1
commit e6d0dcd4e8
4 changed files with 138 additions and 8 deletions

View File

@@ -1753,7 +1753,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
{
// FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up
// with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator
// but not between regions on different simulators). Really, all copying should be done explicitly.
SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone();
dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle;
if (userExposed)
@@ -1799,6 +1803,8 @@ namespace OpenSim.Region.Framework.Scenes
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP;
dupe.m_sittingAvatars = new HashSet<OpenMetaverse.UUID>();
// safeguard actual copy is done in sog.copy
dupe.KeyframeMotion = null;
dupe.PayPrice = (int[])PayPrice.Clone();