diff options
author | Melanie | 2012-07-20 11:54:59 +0200 |
---|---|---|
committer | Melanie | 2012-07-20 11:54:59 +0200 |
commit | fe99948c582cb7a9c0a999bbbc179f254b2e47c7 (patch) | |
tree | 259e24ae8b6b83777d9c6d27ceff345f42f13df9 | |
parent | minor: switch around mixed up circuit code and endpoint data in "show connect... (diff) | |
download | opensim-SC-fe99948c582cb7a9c0a999bbbc179f254b2e47c7.zip opensim-SC-fe99948c582cb7a9c0a999bbbc179f254b2e47c7.tar.gz opensim-SC-fe99948c582cb7a9c0a999bbbc179f254b2e47c7.tar.bz2 opensim-SC-fe99948c582cb7a9c0a999bbbc179f254b2e47c7.tar.xz |
Fix the order of operations on detach. The object must always be serialized
while still in the scene to avoid losing important script state.
DeleteSceneObject can not be called before doing this!
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d34a8f6..0f3b1e8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -690,18 +690,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
690 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); | 690 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); |
691 | sp.RemoveAttachment(so); | 691 | sp.RemoveAttachment(so); |
692 | 692 | ||
693 | // We can only remove the script instances from the script engine after we've retrieved their xml state | ||
694 | // when we update the attachment item. | ||
695 | m_scene.DeleteSceneObject(so, false, false); | ||
696 | |||
697 | // Prepare sog for storage | 693 | // Prepare sog for storage |
698 | so.AttachedAvatar = UUID.Zero; | 694 | so.AttachedAvatar = UUID.Zero; |
699 | so.RootPart.SetParentLocalId(0); | 695 | so.RootPart.SetParentLocalId(0); |
700 | so.IsAttachment = false; | 696 | so.IsAttachment = false; |
701 | so.AbsolutePosition = so.RootPart.AttachedPos; | 697 | |
698 | // We cannot use AbsolutePosition here because that would | ||
699 | // attempt to cross the prim as it is detached | ||
700 | so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); | ||
702 | 701 | ||
703 | UpdateKnownItem(sp, so, true); | 702 | UpdateKnownItem(sp, so, true); |
704 | so.RemoveScriptInstances(true); | 703 | |
704 | // This MUST happen AFTER serialization because it will | ||
705 | // either stop or remove the scripts. Both will cause scripts | ||
706 | // to be serialized in a stopped state with the true run | ||
707 | // state already lost. | ||
708 | m_scene.DeleteSceneObject(so, false, true); | ||
705 | } | 709 | } |
706 | 710 | ||
707 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 711 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |