aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.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/MetaEntity.cs
parentminor: remove mono compiler warning (diff)
downloadopensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.zip
opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.gz
opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.bz2
opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.xz
Improve consistency of locking for SOG.m_parts in order to avoid race conditions in linking and unlinking
Diffstat (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs')
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs38
1 files changed, 24 insertions, 14 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 841ee00..796f437 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -150,15 +150,19 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
150 { 150 {
151 //make new uuids 151 //make new uuids
152 Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>(); 152 Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
153 foreach (SceneObjectPart part in m_Entity.Children.Values) 153
154 lock (m_Entity.Children)
154 { 155 {
155 part.ResetIDs(part.LinkNum); 156 foreach (SceneObjectPart part in m_Entity.Children.Values)
156 parts.Add(part.UUID, part); 157 {
158 part.ResetIDs(part.LinkNum);
159 parts.Add(part.UUID, part);
160 }
161
162 //finalize
163 m_Entity.RootPart.PhysActor = null;
164 m_Entity.Children = parts;
157 } 165 }
158
159 //finalize
160 m_Entity.RootPart.PhysActor = null;
161 m_Entity.Children = parts;
162 } 166 }
163 167
164 #endregion Protected Methods 168 #endregion Protected Methods
@@ -173,8 +177,11 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
173 //This deletes the group without removing from any databases. 177 //This deletes the group without removing from any databases.
174 //This is important because we are not IN any database. 178 //This is important because we are not IN any database.
175 //m_Entity.FakeDeleteGroup(); 179 //m_Entity.FakeDeleteGroup();
176 foreach (SceneObjectPart part in m_Entity.Children.Values) 180 lock (m_Entity.Children)
177 client.SendKillObject(m_Entity.RegionHandle, part.LocalId); 181 {
182 foreach (SceneObjectPart part in m_Entity.Children.Values)
183 client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
184 }
178 } 185 }
179 186
180 /// <summary> 187 /// <summary>
@@ -182,12 +189,15 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
182 /// </summary> 189 /// </summary>
183 public virtual void HideFromAll() 190 public virtual void HideFromAll()
184 { 191 {
185 foreach (SceneObjectPart part in m_Entity.Children.Values) 192 lock (m_Entity.Children)
186 { 193 {
187 m_Entity.Scene.ForEachClient( 194 foreach (SceneObjectPart part in m_Entity.Children.Values)
188 delegate(IClientAPI controller) 195 {
189 { controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); } 196 m_Entity.Scene.ForEachClient(
190 ); 197 delegate(IClientAPI controller)
198 { controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
199 );
200 }
191 } 201 }
192 } 202 }
193 203