diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b70e9df..4dc724d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -552,12 +552,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
552 | 552 | ||
553 | av.IsInTransit = true; | 553 | av.IsInTransit = true; |
554 | 554 | ||
555 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 555 | // A temporary measure to allow regression tests to work. |
556 | d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | 556 | // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget |
557 | // or similar since BeginInvoke() always uses the system threadpool to launch | ||
558 | // threads rather than any replace threadpool that we might be using. | ||
559 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | ||
560 | { | ||
561 | entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version); | ||
562 | CrossAgentToNewRegionCompleted(av); | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
567 | d.BeginInvoke( | ||
568 | av, val, destination, av.Flying, version, | ||
569 | ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); | ||
570 | } | ||
557 | } | 571 | } |
558 | else | 572 | else |
573 | { | ||
559 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); | 574 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); |
575 | } | ||
560 | } | 576 | } |
577 | |||
561 | avsToCross.Clear(); | 578 | avsToCross.Clear(); |
562 | return; | 579 | return; |
563 | } | 580 | } |
@@ -630,11 +647,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
630 | set { RootPart.Velocity = value; } | 647 | set { RootPart.Velocity = value; } |
631 | } | 648 | } |
632 | 649 | ||
633 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 650 | private void CrossAgentToNewRegionCompleted(ScenePresence agent) |
634 | { | 651 | { |
635 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
636 | ScenePresence agent = icon.EndInvoke(iar); | ||
637 | |||
638 | //// If the cross was successful, this agent is a child agent | 652 | //// If the cross was successful, this agent is a child agent |
639 | if (agent.IsChildAgent) | 653 | if (agent.IsChildAgent) |
640 | { | 654 | { |
@@ -1698,10 +1712,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1698 | /// <returns></returns> | 1712 | /// <returns></returns> |
1699 | public SceneObjectGroup Copy(bool userExposed) | 1713 | public SceneObjectGroup Copy(bool userExposed) |
1700 | { | 1714 | { |
1715 | // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up | ||
1716 | // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator | ||
1717 | // but not between regions on different simulators). Really, all copying should be done explicitly. | ||
1701 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 1718 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
1719 | |||
1702 | dupe.Backup = false; | 1720 | dupe.Backup = false; |
1703 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 1721 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
1704 | dupe.m_sittingAvatars = new List<UUID>(); | 1722 | dupe.m_sittingAvatars = new List<UUID>(); |
1723 | dupe.m_linkedAvatars = new List<ScenePresence>(); | ||
1705 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1724 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
1706 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 1725 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
1707 | 1726 | ||