Lock the attachment cleanup so it doesn't go into an endless deletion frenzy

avinationmerge
Melanie Thielker 2010-08-25 16:06:06 +02:00
parent ef5b628191
commit 314d1171ef
1 changed files with 20 additions and 16 deletions

View File

@ -399,6 +399,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_firstHeartbeat = true; private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object(); private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
// the minimum time that must elapse before a changed object will be considered for persisted // the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
@ -5051,25 +5052,28 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> objectsToDelete = List<SceneObjectGroup> objectsToDelete =
new List<SceneObjectGroup>(); new List<SceneObjectGroup>();
ForEachSOG(delegate (SceneObjectGroup grp) lock (m_cleaningAttachments)
{ {
if (grp.RootPart.Shape.State != 0) ForEachSOG(delegate (SceneObjectGroup grp)
{ {
UUID agentID = grp.OwnerID; if (grp.RootPart.Shape.State != 0 || objectsToDelete.Contains(grp))
if (agentID == UUID.Zero)
{ {
objectsToDelete.Add(grp); UUID agentID = grp.OwnerID;
return; if (agentID == UUID.Zero)
} {
objectsToDelete.Add(grp);
return;
}
ScenePresence sp = GetScenePresence(agentID); ScenePresence sp = GetScenePresence(agentID);
if (sp == null) if (sp == null)
{ {
objectsToDelete.Add(grp); objectsToDelete.Add(grp);
return; return;
}
} }
} });
}); }
foreach (SceneObjectGroup grp in objectsToDelete) foreach (SceneObjectGroup grp in objectsToDelete)
{ {