aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-10 22:41:11 +0100
committerJustin Clark-Casey (justincc)2012-07-10 22:41:11 +0100
commitf3134b5cf688af9b824880e0221072b24d22f33e (patch)
tree94ac27ba4fd2f7f0700cc626005d20d7c6465881 /OpenSim/Region/CoreModules
parentIf a script is being stopped manually, then give the scriptpool thread 1 seco... (diff)
downloadopensim-SC_OLD-f3134b5cf688af9b824880e0221072b24d22f33e.zip
opensim-SC_OLD-f3134b5cf688af9b824880e0221072b24d22f33e.tar.gz
opensim-SC_OLD-f3134b5cf688af9b824880e0221072b24d22f33e.tar.bz2
opensim-SC_OLD-f3134b5cf688af9b824880e0221072b24d22f33e.tar.xz
When an attachment is detached to inv or derezzed, stop the scripts, update the known item with script state still in the script engine and then remove the scripts.
This is to fix a regression starting from 5301648 where attachments had to start being deleted before persistence in order to avoid race conditions with hud update threads.
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(