aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-07-20 11:54:59 +0200
committerMelanie2012-07-20 16:45:24 +0200
commit1598f9d1790d18f0ebd78bddc088b6e57829aca5 (patch)
treefdd759a92cfa8219d39819f6d8646a9cbec08371
parentMerge branch 'ubitwork' into avination (diff)
downloadopensim-SC-1598f9d1790d18f0ebd78bddc088b6e57829aca5.zip
opensim-SC-1598f9d1790d18f0ebd78bddc088b6e57829aca5.tar.gz
opensim-SC-1598f9d1790d18f0ebd78bddc088b6e57829aca5.tar.bz2
opensim-SC-1598f9d1790d18f0ebd78bddc088b6e57829aca5.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.cs16
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 394b90a..f073c4a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -757,18 +757,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
757 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); 757 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero);
758 sp.RemoveAttachment(so); 758 sp.RemoveAttachment(so);
759 759
760 // We can only remove the script instances from the script engine after we've retrieved their xml state
761 // when we update the attachment item.
762 m_scene.DeleteSceneObject(so, false, false);
763
764 // Prepare sog for storage 760 // Prepare sog for storage
765 so.AttachedAvatar = UUID.Zero; 761 so.AttachedAvatar = UUID.Zero;
766 so.RootPart.SetParentLocalId(0); 762 so.RootPart.SetParentLocalId(0);
767 so.IsAttachment = false; 763 so.IsAttachment = false;
768 so.AbsolutePosition = so.RootPart.AttachedPos; 764
765 // We cannot use AbsolutePosition here because that would
766 // attempt to cross the prim as it is detached
767 so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; });
769 768
770 UpdateKnownItem(sp, so, true); 769 UpdateKnownItem(sp, so, true);
771 so.RemoveScriptInstances(true); 770
771 // This MUST happen AFTER serialization because it will
772 // either stop or remove the scripts. Both will cause scripts
773 // to be serialized in a stopped state with the true run
774 // state already lost.
775 m_scene.DeleteSceneObject(so, false, true);
772 } 776 }
773 777
774 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 778 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(