Change object cleanup again. Make scene object directories more robust and

prevent deleted SOP's from sticking around
avinationmerge
Melanie Thielker 2010-08-25 23:11:00 +02:00
parent 1bcb2e788f
commit dc1baf8025
2 changed files with 30 additions and 19 deletions

View File

@ -3211,8 +3211,6 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager.TriggerOnRemovePresence(agentID); m_eventManager.TriggerOnRemovePresence(agentID);
m_log.Debug("[Scene] Finished OnRemovePresence"); m_log.Debug("[Scene] Finished OnRemovePresence");
CleanDroppedAttachments();
ForEachClient( ForEachClient(
delegate(IClientAPI client) delegate(IClientAPI client)
{ {
@ -3248,6 +3246,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_log.Debug("[Scene] Done. Firing RemoveCircuit"); m_log.Debug("[Scene] Done. Firing RemoveCircuit");
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
CleanDroppedAttachments();
m_log.Debug("[Scene] The avatar has left the building"); m_log.Debug("[Scene] The avatar has left the building");
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
//m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));

View File

@ -104,7 +104,6 @@ namespace OpenSim.Region.Framework.Scenes
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>();
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
private readonly Object m_dictionary_lock = new Object();
private Object m_updateLock = new Object(); private Object m_updateLock = new Object();
@ -150,11 +149,10 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresencesLock.ExitWriteLock(); m_scenePresencesLock.ExitWriteLock();
} }
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID.Clear(); SceneObjectGroupsByFullID.Clear();
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.Clear(); SceneObjectGroupsByLocalID.Clear();
}
Entities.Clear(); Entities.Clear();
} }
@ -385,17 +383,19 @@ namespace OpenSim.Region.Framework.Scenes
OnObjectCreate(sceneObject); OnObjectCreate(sceneObject);
} }
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{ {
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
{
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
} }
} }
}
return true; return true;
} }
@ -408,24 +408,32 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (Entities.ContainsKey(uuid)) if (Entities.ContainsKey(uuid))
{ {
SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid];
if (!resultOfObjectLinked) if (!resultOfObjectLinked)
{ {
m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count;
if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
{ RemovePhysicalPrim(grp.Children.Count);
RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count);
}
} }
if (OnObjectRemove != null) if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]); OnObjectRemove(Entities[uuid]);
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{ {
SceneObjectGroupsByFullID.Remove(uuid); foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(((SceneObjectGroup)Entities[uuid]).LocalId); SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
} }
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
Entities.Remove(uuid); Entities.Remove(uuid);
//SceneObjectGroup part; //SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
@ -884,7 +892,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
{ {
if (sog.HasChildPrim(localID))
return sog; return sog;
SceneObjectGroupsByLocalID.Remove(localID);
} }
} }
@ -920,7 +930,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
{ {
if (sog.Children.ContainsKey(fullID))
return sog; return sog;
SceneObjectGroupsByFullID.Remove(fullID);
} }
} }