diff options
author | Justin Clark-Casey (justincc) | 2010-08-26 00:08:53 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-26 00:08:53 +0100 |
commit | 8031f8ec09df4f654c86a9c7bc498664f7b9d9dc (patch) | |
tree | d6a6da4d448b9bc11ff8d1078b9be089b9872151 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | minor: remove mono compiler warning (diff) | |
download | opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.zip opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.gz opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.bz2 opensim-SC_OLD-8031f8ec09df4f654c86a9c7bc498664f7b9d9dc.tar.xz |
Improve consistency of locking for SOG.m_parts in order to avoid race conditions in linking and unlinking
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b808c6d..8556105 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1756,8 +1756,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1756 | 1756 | ||
1757 | if (group.RootPart == null) | 1757 | if (group.RootPart == null) |
1758 | { | 1758 | { |
1759 | m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", | 1759 | m_log.ErrorFormat( |
1760 | group.Children == null ? 0 : group.Children.Count); | 1760 | "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", |
1761 | group.Children == null ? 0 : group.PrimCount); | ||
1761 | } | 1762 | } |
1762 | 1763 | ||
1763 | AddRestoredSceneObject(group, true, true); | 1764 | AddRestoredSceneObject(group, true, true); |
@@ -2064,18 +2065,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | group.RemoveScriptInstances(true); | 2065 | group.RemoveScriptInstances(true); |
2065 | } | 2066 | } |
2066 | 2067 | ||
2067 | foreach (SceneObjectPart part in group.Children.Values) | 2068 | lock (group.Children) |
2068 | { | 2069 | { |
2069 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2070 | foreach (SceneObjectPart part in group.Children.Values) |
2070 | { | 2071 | { |
2071 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2072 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2072 | } | 2073 | { |
2073 | else if (part.PhysActor != null) | 2074 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
2074 | { | 2075 | } |
2075 | PhysicsScene.RemovePrim(part.PhysActor); | 2076 | else if (part.PhysActor != null) |
2076 | part.PhysActor = null; | 2077 | { |
2078 | PhysicsScene.RemovePrim(part.PhysActor); | ||
2079 | part.PhysActor = null; | ||
2080 | } | ||
2077 | } | 2081 | } |
2078 | } | 2082 | } |
2083 | |||
2079 | // if (rootPart.PhysActor != null) | 2084 | // if (rootPart.PhysActor != null) |
2080 | // { | 2085 | // { |
2081 | // PhysicsScene.RemovePrim(rootPart.PhysActor); | 2086 | // PhysicsScene.RemovePrim(rootPart.PhysActor); |
@@ -2426,14 +2431,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2426 | 2431 | ||
2427 | // Force allocation of new LocalId | 2432 | // Force allocation of new LocalId |
2428 | // | 2433 | // |
2429 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2434 | lock (sceneObject.Children) |
2430 | p.LocalId = 0; | 2435 | { |
2436 | foreach (SceneObjectPart p in sceneObject.Children.Values) | ||
2437 | p.LocalId = 0; | ||
2438 | } | ||
2431 | 2439 | ||
2432 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2440 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2433 | { | 2441 | { |
2434 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2442 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2435 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2443 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2436 | |||
2437 | 2444 | ||
2438 | // Don't sent a full update here because this will cause full updates to be sent twice for | 2445 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2439 | // attachments on region crossings, resulting in viewer glitches. | 2446 | // attachments on region crossings, resulting in viewer glitches. |
@@ -2447,7 +2454,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2447 | 2454 | ||
2448 | if (sp != null) | 2455 | if (sp != null) |
2449 | { | 2456 | { |
2450 | |||
2451 | SceneObjectGroup grp = sceneObject; | 2457 | SceneObjectGroup grp = sceneObject; |
2452 | 2458 | ||
2453 | m_log.DebugFormat( | 2459 | m_log.DebugFormat( |
@@ -2459,7 +2465,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2459 | 2465 | ||
2460 | if (AttachmentsModule != null) | 2466 | if (AttachmentsModule != null) |
2461 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2467 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2462 | |||
2463 | } | 2468 | } |
2464 | else | 2469 | else |
2465 | { | 2470 | { |