diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8705dd57af..77abcd7091 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -929,8 +929,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent) { if (fireDetachEvent) + { m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); + // Allow detach event time to do some work before stopping the script + Thread.Sleep(2); + } + using (StringWriter sw = new StringWriter()) { using (XmlTextWriter writer = new XmlTextWriter(sw))