aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie Thielker2010-08-25 23:11:00 +0200
committerMelanie2010-08-25 23:19:30 +0100
commit604423d52bb66b1cc08adac557450addc7ebc94b (patch)
treef3e7948fde215f50cfff9957c1c7dc641d5ec69d /OpenSim/Region/Framework/Scenes
parentChange some e.Message to e.ToString. Don't use e.Message, it doesn't carry (diff)
downloadopensim-SC_OLD-604423d52bb66b1cc08adac557450addc7ebc94b.zip
opensim-SC_OLD-604423d52bb66b1cc08adac557450addc7ebc94b.tar.gz
opensim-SC_OLD-604423d52bb66b1cc08adac557450addc7ebc94b.tar.bz2
opensim-SC_OLD-604423d52bb66b1cc08adac557450addc7ebc94b.tar.xz
Make scene object directories more robust and prevent deleted SOP's from
sticking around
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs46
2 files changed, 29 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b808c6d..f4cbe1f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3159,7 +3159,6 @@ namespace OpenSim.Region.Framework.Scenes
3159 } 3159 }
3160 3160
3161 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3161 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3162
3163 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3162 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
3164 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); 3163 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
3165 } 3164 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 31faeec..58a7661 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -95,7 +95,6 @@ namespace OpenSim.Region.Framework.Scenes
95 95
96 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); 96 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>();
97 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); 97 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
98 private readonly Object m_dictionary_lock = new Object();
99 98
100 private Object m_updateLock = new Object(); 99 private Object m_updateLock = new Object();
101 100
@@ -136,11 +135,10 @@ namespace OpenSim.Region.Framework.Scenes
136 m_scenePresenceArray = newlist; 135 m_scenePresenceArray = newlist;
137 } 136 }
138 137
139 lock (m_dictionary_lock) 138 lock (SceneObjectGroupsByFullID)
140 {
141 SceneObjectGroupsByFullID.Clear(); 139 SceneObjectGroupsByFullID.Clear();
140 lock (SceneObjectGroupsByLocalID)
142 SceneObjectGroupsByLocalID.Clear(); 141 SceneObjectGroupsByLocalID.Clear();
143 }
144 142
145 Entities.Clear(); 143 Entities.Clear();
146 } 144 }
@@ -395,15 +393,17 @@ namespace OpenSim.Region.Framework.Scenes
395 if (OnObjectCreate != null) 393 if (OnObjectCreate != null)
396 OnObjectCreate(sceneObject); 394 OnObjectCreate(sceneObject);
397 395
398 lock (m_dictionary_lock) 396 lock (SceneObjectGroupsByFullID)
399 { 397 {
400 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 398 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
401 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
402 foreach (SceneObjectPart part in sceneObject.Children.Values) 399 foreach (SceneObjectPart part in sceneObject.Children.Values)
403 {
404 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 400 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
401 }
402 lock (SceneObjectGroupsByLocalID)
403 {
404 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
405 foreach (SceneObjectPart part in sceneObject.Children.Values)
405 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 406 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
406 }
407 } 407 }
408 } 408 }
409 409
@@ -418,24 +418,32 @@ namespace OpenSim.Region.Framework.Scenes
418 { 418 {
419 if (Entities.ContainsKey(uuid)) 419 if (Entities.ContainsKey(uuid))
420 { 420 {
421 SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid];
422
421 if (!resultOfObjectLinked) 423 if (!resultOfObjectLinked)
422 { 424 {
423 m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; 425 m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count;
424 426
425 if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 427 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
426 { 428 RemovePhysicalPrim(grp.Children.Count);
427 RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count);
428 }
429 } 429 }
430 430
431 if (OnObjectRemove != null) 431 if (OnObjectRemove != null)
432 OnObjectRemove(Entities[uuid]); 432 OnObjectRemove(Entities[uuid]);
433 433
434 lock (m_dictionary_lock) 434 lock (SceneObjectGroupsByFullID)
435 { 435 {
436 SceneObjectGroupsByFullID.Remove(uuid); 436 foreach (SceneObjectPart part in grp.Children.Values)
437 SceneObjectGroupsByLocalID.Remove(((SceneObjectGroup)Entities[uuid]).LocalId); 437 SceneObjectGroupsByFullID.Remove(part.UUID);
438 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
438 } 439 }
440 lock (SceneObjectGroupsByLocalID)
441 {
442 foreach (SceneObjectPart part in grp.Children.Values)
443 SceneObjectGroupsByLocalID.Remove(part.LocalId);
444 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
445 }
446
439 Entities.Remove(uuid); 447 Entities.Remove(uuid);
440 //SceneObjectGroup part; 448 //SceneObjectGroup part;
441 //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 449 //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
@@ -860,7 +868,9 @@ namespace OpenSim.Region.Framework.Scenes
860 { 868 {
861 if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) 869 if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
862 { 870 {
863 return sog; 871 if (sog.HasChildPrim(localID))
872 return sog;
873 SceneObjectGroupsByLocalID.Remove(localID);
864 } 874 }
865 } 875 }
866 876
@@ -896,7 +906,9 @@ namespace OpenSim.Region.Framework.Scenes
896 { 906 {
897 if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) 907 if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
898 { 908 {
899 return sog; 909 if (sog.Children.ContainsKey(fullID))
910 return sog;
911 SceneObjectGroupsByFullID.Remove(fullID);
900 } 912 }
901 } 913 }
902 914