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,9 +5052,11 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> objectsToDelete = List<SceneObjectGroup> objectsToDelete =
new List<SceneObjectGroup>(); new List<SceneObjectGroup>();
lock (m_cleaningAttachments)
{
ForEachSOG(delegate (SceneObjectGroup grp) ForEachSOG(delegate (SceneObjectGroup grp)
{ {
if (grp.RootPart.Shape.State != 0) if (grp.RootPart.Shape.State != 0 || objectsToDelete.Contains(grp))
{ {
UUID agentID = grp.OwnerID; UUID agentID = grp.OwnerID;
if (agentID == UUID.Zero) if (agentID == UUID.Zero)
@ -5070,6 +5073,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
}); });
}
foreach (SceneObjectGroup grp in objectsToDelete) foreach (SceneObjectGroup grp in objectsToDelete)
{ {