aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index eccf7a6..efab6ed 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -211,16 +211,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
211 211
212 lock (sp.AttachmentsSyncLock) 212 lock (sp.AttachmentsSyncLock)
213 { 213 {
214 foreach (SceneObjectGroup grp in sp.GetAttachments()) 214 foreach (SceneObjectGroup so in sp.GetAttachments())
215 { 215 {
216 grp.Scene.DeleteSceneObject(grp, false); 216 // We can only remove the script instances from the script engine after we've retrieved their xml state
217 // when we update the attachment item.
218 m_scene.DeleteSceneObject(so, false, false);
217 219
218 if (saveChanged || saveAllScripted) 220 if (saveChanged || saveAllScripted)
219 { 221 {
220 grp.IsAttachment = false; 222 so.IsAttachment = false;
221 grp.AbsolutePosition = grp.RootPart.AttachedPos; 223 so.AbsolutePosition = so.RootPart.AttachedPos;
222 UpdateKnownItem(sp, grp, saveAllScripted); 224 UpdateKnownItem(sp, so, saveAllScripted);
223 } 225 }
226
227 so.RemoveScriptInstances(true);
224 } 228 }
225 229
226 sp.ClearAttachments(); 230 sp.ClearAttachments();
@@ -682,7 +686,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
682 686
683 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); 687 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero);
684 sp.RemoveAttachment(so); 688 sp.RemoveAttachment(so);
685 m_scene.DeleteSceneObject(so, false); 689
690 // We can only remove the script instances from the script engine after we've retrieved their xml state
691 // when we update the attachment item.
692 m_scene.DeleteSceneObject(so, false, false);
686 693
687 // Prepare sog for storage 694 // Prepare sog for storage
688 so.AttachedAvatar = UUID.Zero; 695 so.AttachedAvatar = UUID.Zero;
@@ -691,6 +698,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
691 so.AbsolutePosition = so.RootPart.AttachedPos; 698 so.AbsolutePosition = so.RootPart.AttachedPos;
692 699
693 UpdateKnownItem(sp, so, true); 700 UpdateKnownItem(sp, so, true);
701 so.RemoveScriptInstances(true);
694 } 702 }
695 703
696 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 704 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(