aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-25 22:48:13 +0100
committerJustin Clark-Casey (justincc)2012-06-25 22:48:13 +0100
commite5b739aaebace6b028f3f6bf05d21ff7a7c5affe (patch)
treef76c578681da34fddb0c36eeada8af57eaf0bbc4 /OpenSim/Region/CoreModules/Avatar/Attachments
parentIn AttachmentsModule.DetachSingleAttachmentToInvInternal(), remove attachment... (diff)
downloadopensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.zip
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.gz
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.bz2
opensim-SC_OLD-e5b739aaebace6b028f3f6bf05d21ff7a7c5affe.tar.xz
When attachments are being saved and deleted for a closing root agent, delete first to avoid a hud race condition with update threads.
If delete doesn't occur first then the update thread can outrace the IsAttachment = false necessary to save attachments and send hud artifacts to other viewers.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs33
1 files changed, 21 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 99e0153..2b0e4ab 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -152,31 +152,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
152 } 152 }
153 } 153 }
154 154
155 public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted) 155 public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted)
156 { 156 {
157// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
158
159 if (!Enabled) 157 if (!Enabled)
160 return; 158 return;
161 159
162 foreach (SceneObjectGroup grp in sp.GetAttachments()) 160// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
161
162 lock (sp.AttachmentsSyncLock)
163 { 163 {
164 grp.IsAttachment = false; 164 foreach (SceneObjectGroup grp in sp.GetAttachments())
165 grp.AbsolutePosition = grp.RootPart.AttachedPos; 165 {
166 UpdateKnownItem(sp, grp, saveAllScripted); 166 grp.Scene.DeleteSceneObject(grp, false);
167 grp.IsAttachment = true; 167
168 if (saveChanged || saveAllScripted)
169 {
170 grp.IsAttachment = false;
171 grp.AbsolutePosition = grp.RootPart.AttachedPos;
172 UpdateKnownItem(sp, grp, saveAllScripted);
173 }
174 }
175
176 sp.ClearAttachments();
168 } 177 }
169 } 178 }
170 179
171 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) 180 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
172 { 181 {
173// m_log.DebugFormat(
174// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
175// m_scene.RegionInfo.RegionName, sp.Name, silent);
176
177 if (!Enabled) 182 if (!Enabled)
178 return; 183 return;
179 184
185// m_log.DebugFormat(
186// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
187// m_scene.RegionInfo.RegionName, sp.Name, silent);
188
180 foreach (SceneObjectGroup sop in sp.GetAttachments()) 189 foreach (SceneObjectGroup sop in sp.GetAttachments())
181 { 190 {
182 sop.Scene.DeleteSceneObject(sop, silent); 191 sop.Scene.DeleteSceneObject(sop, silent);