diff options
author | Melanie Thielker | 2010-08-25 23:11:00 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-08-25 23:11:00 +0200 |
commit | dc1baf802545329fc78d5fa36174e27025629527 (patch) | |
tree | 8b53813f3de2982b63c1767f3018801b9c6e67e8 /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | Change some e.Message to e.ToString. Don't use e.Message, it doesn't carry (diff) | |
download | opensim-SC-dc1baf802545329fc78d5fa36174e27025629527.zip opensim-SC-dc1baf802545329fc78d5fa36174e27025629527.tar.gz opensim-SC-dc1baf802545329fc78d5fa36174e27025629527.tar.bz2 opensim-SC-dc1baf802545329fc78d5fa36174e27025629527.tar.xz |
Change object cleanup again. Make scene object directories more robust and
prevent deleted SOP's from sticking around
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 94ec534..1268259 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -104,7 +104,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | 104 | ||
105 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); | 105 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); |
106 | protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); | 106 | protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); |
107 | private readonly Object m_dictionary_lock = new Object(); | ||
108 | 107 | ||
109 | private Object m_updateLock = new Object(); | 108 | private Object m_updateLock = new Object(); |
110 | 109 | ||
@@ -150,11 +149,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | m_scenePresencesLock.ExitWriteLock(); | 149 | m_scenePresencesLock.ExitWriteLock(); |
151 | } | 150 | } |
152 | 151 | ||
153 | lock (m_dictionary_lock) | 152 | lock (SceneObjectGroupsByFullID) |
154 | { | ||
155 | SceneObjectGroupsByFullID.Clear(); | 153 | SceneObjectGroupsByFullID.Clear(); |
154 | lock (SceneObjectGroupsByLocalID) | ||
156 | SceneObjectGroupsByLocalID.Clear(); | 155 | SceneObjectGroupsByLocalID.Clear(); |
157 | } | ||
158 | 156 | ||
159 | Entities.Clear(); | 157 | Entities.Clear(); |
160 | } | 158 | } |
@@ -385,15 +383,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
385 | OnObjectCreate(sceneObject); | 383 | OnObjectCreate(sceneObject); |
386 | } | 384 | } |
387 | 385 | ||
388 | lock (m_dictionary_lock) | 386 | lock (SceneObjectGroupsByFullID) |
389 | { | 387 | { |
390 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 388 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
391 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
392 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 389 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
393 | { | ||
394 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | 390 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
391 | } | ||
392 | lock (SceneObjectGroupsByLocalID) | ||
393 | { | ||
394 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
395 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
395 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | 396 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; |
396 | } | ||
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
@@ -408,24 +408,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
408 | { | 408 | { |
409 | if (Entities.ContainsKey(uuid)) | 409 | if (Entities.ContainsKey(uuid)) |
410 | { | 410 | { |
411 | SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; | ||
412 | |||
411 | if (!resultOfObjectLinked) | 413 | if (!resultOfObjectLinked) |
412 | { | 414 | { |
413 | m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; | 415 | m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; |
414 | 416 | ||
415 | if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 417 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
416 | { | 418 | RemovePhysicalPrim(grp.Children.Count); |
417 | RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count); | ||
418 | } | ||
419 | } | 419 | } |
420 | 420 | ||
421 | if (OnObjectRemove != null) | 421 | if (OnObjectRemove != null) |
422 | OnObjectRemove(Entities[uuid]); | 422 | OnObjectRemove(Entities[uuid]); |
423 | 423 | ||
424 | lock (m_dictionary_lock) | 424 | lock (SceneObjectGroupsByFullID) |
425 | { | 425 | { |
426 | SceneObjectGroupsByFullID.Remove(uuid); | 426 | foreach (SceneObjectPart part in grp.Children.Values) |
427 | SceneObjectGroupsByLocalID.Remove(((SceneObjectGroup)Entities[uuid]).LocalId); | 427 | SceneObjectGroupsByFullID.Remove(part.UUID); |
428 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | ||
428 | } | 429 | } |
430 | lock (SceneObjectGroupsByLocalID) | ||
431 | { | ||
432 | foreach (SceneObjectPart part in grp.Children.Values) | ||
433 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | ||
434 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | ||
435 | } | ||
436 | |||
429 | Entities.Remove(uuid); | 437 | Entities.Remove(uuid); |
430 | //SceneObjectGroup part; | 438 | //SceneObjectGroup part; |
431 | //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 439 | //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
@@ -884,7 +892,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
884 | { | 892 | { |
885 | if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) | 893 | if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) |
886 | { | 894 | { |
887 | return sog; | 895 | if (sog.HasChildPrim(localID)) |
896 | return sog; | ||
897 | SceneObjectGroupsByLocalID.Remove(localID); | ||
888 | } | 898 | } |
889 | } | 899 | } |
890 | 900 | ||
@@ -920,7 +930,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
920 | { | 930 | { |
921 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) | 931 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) |
922 | { | 932 | { |
923 | return sog; | 933 | if (sog.Children.ContainsKey(fullID)) |
934 | return sog; | ||
935 | SceneObjectGroupsByFullID.Remove(fullID); | ||
924 | } | 936 | } |
925 | } | 937 | } |
926 | 938 | ||