aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-26 00:08:53 +0100
committerJustin Clark-Casey (justincc)2010-08-26 00:08:53 +0100
commit8031f8ec09df4f654c86a9c7bc498664f7b9d9dc (patch)
treed6a6da4d448b9bc11ff8d1078b9be089b9872151 /OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
parentminor: remove mono compiler warning (diff)
downloadopensim-SC-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.zip
opensim-SC-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.gz
opensim-SC-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.bz2
opensim-SC-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.xz
Improve consistency of locking for SOG.m_parts in order to avoid race conditions in linking and unlinking
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs35
1 files changed, 24 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index 0dc78c0..e5fcb54 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -167,9 +167,12 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
167 public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group) 167 public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
168 { 168 {
169 // Deal with new parts not revisioned that have been deleted. 169 // Deal with new parts not revisioned that have been deleted.
170 foreach (SceneObjectPart part in group.Children.Values) 170 lock (group.Children)
171 if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID)) 171 {
172 m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID); 172 foreach (SceneObjectPart part in group.Children.Values)
173 if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
174 m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
175 }
173 } 176 }
174 177
175 /// <summary> 178 /// <summary>
@@ -207,8 +210,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
207 { 210 {
208 temp = SceneObjectSerializer.FromXml2Format(xml); 211 temp = SceneObjectSerializer.FromXml2Format(xml);
209 temp.SetScene(scene); 212 temp.SetScene(scene);
210 foreach (SceneObjectPart part in temp.Children.Values) 213
211 part.RegionHandle = scene.RegionInfo.RegionHandle; 214 lock (temp.Children)
215 {
216 foreach (SceneObjectPart part in temp.Children.Values)
217 part.RegionHandle = scene.RegionInfo.RegionHandle;
218 }
219
212 ReplacementList.Add(temp.UUID, (EntityBase)temp); 220 ReplacementList.Add(temp.UUID, (EntityBase)temp);
213 } 221 }
214 catch (Exception e) 222 catch (Exception e)
@@ -338,15 +346,20 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
338 System.Collections.ArrayList auraList = new System.Collections.ArrayList(); 346 System.Collections.ArrayList auraList = new System.Collections.ArrayList();
339 if (group == null) 347 if (group == null)
340 return null; 348 return null;
341 foreach (SceneObjectPart part in group.Children.Values) 349
350 lock (group.Children)
342 { 351 {
343 if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID)) 352 foreach (SceneObjectPart part in group.Children.Values)
344 { 353 {
345 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new Vector3(0,254,0), part.Scale); 354 if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
346 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition(); 355 {
347 auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]); 356 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new Vector3(0,254,0), part.Scale);
357 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
358 auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
359 }
348 } 360 }
349 } 361 }
362
350 return auraList; 363 return auraList;
351 } 364 }
352 365