aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-17 15:40:27 +0000
committerJustin Clarke Casey2008-11-17 15:40:27 +0000
commitd54b6608a7acfa7fc9fd074f2fbd241519067fcb (patch)
tree4fb604c6b80f0e67d9ea8e884941386a9a4d6a4f /OpenSim/Region/Environment
parentfixing warnings in YProlog language support (diff)
downloadopensim-SC-d54b6608a7acfa7fc9fd074f2fbd241519067fcb.zip
opensim-SC-d54b6608a7acfa7fc9fd074f2fbd241519067fcb.tar.gz
opensim-SC-d54b6608a7acfa7fc9fd074f2fbd241519067fcb.tar.bz2
opensim-SC-d54b6608a7acfa7fc9fd074f2fbd241519067fcb.tar.xz
* Stop nulling SOG.m_rootPart and parts on object deletion
* This renders RootPart == null checks useless - the replacement is to check SOG.IsDeleted. However, in many cases this will not be necessary since updates to deleted parts will not be sent to the client * This should remove any remaining race conditions where an object is deleted while another thread is yet to obtain the root part to perform some operation * Doing this is probably a necessary prerequisite to moving to a model without a separate SOG and SOP * Unfortunately it's not possible to eliminate all RootPart == null checks since in some contexts it is currently used to check whether an object was created successfully
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs10
6 files changed, 27 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
index 706ba6a..442b40d 100644
--- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.Scenes
126 "[SCENE]: Sending deleted object to user's inventory, {0} item(s) remaining.", left); 126 "[SCENE]: Sending deleted object to user's inventory, {0} item(s) remaining.", left);
127 127
128 x = m_inventoryDeletes.Dequeue(); 128 x = m_inventoryDeletes.Dequeue();
129 if (x.objectGroup.RootPart != null) 129 if (!x.objectGroup.IsDeleted)
130 { 130 {
131 try 131 try
132 { 132 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 9ad8382..cc8501d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1552,7 +1552,7 @@ namespace OpenSim.Region.Environment.Scenes
1552 if (part == null) 1552 if (part == null)
1553 return; 1553 return;
1554 1554
1555 if (part.ParentGroup == null || part.ParentGroup.RootPart == null) 1555 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
1556 return; 1556 return;
1557 1557
1558 // Can't delete child prims 1558 // Can't delete child prims
@@ -2379,7 +2379,7 @@ namespace OpenSim.Region.Environment.Scenes
2379 public UUID RezSingleAttachment(SceneObjectGroup att, 2379 public UUID RezSingleAttachment(SceneObjectGroup att,
2380 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 2380 IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
2381 { 2381 {
2382 if (att.RootPart != null) 2382 if (!att.IsDeleted)
2383 AttachmentPt = att.RootPart.AttachmentPoint; 2383 AttachmentPt = att.RootPart.AttachmentPoint;
2384 2384
2385 ScenePresence presence; 2385 ScenePresence presence;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index c055160..cf743de 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2015,7 +2015,7 @@ namespace OpenSim.Region.Environment.Scenes
2015 { 2015 {
2016 if (grp == null) 2016 if (grp == null)
2017 return; 2017 return;
2018 if (grp.RootPart == null) 2018 if (grp.IsDeleted)
2019 return; 2019 return;
2020 2020
2021 if (grp.RootPart.DIE_AT_EDGE) 2021 if (grp.RootPart.DIE_AT_EDGE)
@@ -2116,7 +2116,7 @@ namespace OpenSim.Region.Environment.Scenes
2116 } 2116 }
2117 else 2117 else
2118 { 2118 {
2119 if (grp.RootPart != null) 2119 if (!grp.IsDeleted)
2120 { 2120 {
2121 if (grp.RootPart.PhysActor != null) 2121 if (grp.RootPart.PhysActor != null)
2122 { 2122 {
@@ -2688,7 +2688,7 @@ namespace OpenSim.Region.Environment.Scenes
2688 SceneObjectPart part = GetSceneObjectPart(localID); 2688 SceneObjectPart part = GetSceneObjectPart(localID);
2689 if (part != null) // It is a prim 2689 if (part != null) // It is a prim
2690 { 2690 {
2691 if (part.ParentGroup != null && part.ParentGroup.RootPart != null) // Valid 2691 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid
2692 { 2692 {
2693 if (part.ParentGroup.RootPart != part) // Child part 2693 if (part.ParentGroup.RootPart != part) // Child part
2694 return; 2694 return;
@@ -4200,7 +4200,7 @@ namespace OpenSim.Region.Environment.Scenes
4200 if (part == null || part.ParentGroup == null) 4200 if (part == null || part.ParentGroup == null)
4201 return; 4201 return;
4202 4202
4203 if (part.ParentGroup.RootPart == null) 4203 if (part.ParentGroup.IsDeleted)
4204 return; 4204 return;
4205 4205
4206 part = part.ParentGroup.RootPart; 4206 part = part.ParentGroup.RootPart;
@@ -4366,7 +4366,7 @@ namespace OpenSim.Region.Environment.Scenes
4366 { 4366 {
4367 SceneObjectGroup grp = (SceneObjectGroup)obj; 4367 SceneObjectGroup grp = (SceneObjectGroup)obj;
4368 4368
4369 if (grp.RootPart != null) 4369 if (!grp.IsDeleted)
4370 { 4370 {
4371 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 4371 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
4372 { 4372 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 0af2ad2..36b4e10 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1035,9 +1035,6 @@ namespace OpenSim.Region.Environment.Scenes
1035 public void DeleteGroup(bool silent) 1035 public void DeleteGroup(bool silent)
1036 { 1036 {
1037 // We need to keep track of this state in case this group is still queued for backup. 1037 // We need to keep track of this state in case this group is still queued for backup.
1038 // FIXME: This is a poor temporary solution, since it still leaves plenty of scope for race
1039 // conditions where a user deletes an entity while it is being stored. Really, the update
1040 // code needs a redesign.
1041 m_isDeleted = true; 1038 m_isDeleted = true;
1042 1039
1043 DetachFromBackup(); 1040 DetachFromBackup();
@@ -1063,9 +1060,6 @@ namespace OpenSim.Region.Environment.Scenes
1063 } 1060 }
1064 } 1061 }
1065 } 1062 }
1066
1067 m_rootPart = null;
1068 m_parts.Clear();
1069 } 1063 }
1070 } 1064 }
1071 1065
@@ -1228,7 +1222,7 @@ namespace OpenSim.Region.Environment.Scenes
1228 // Since this is the top of the section of call stack for backing up a particular scene object, don't let 1222 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1229 // any exception propogate upwards. 1223 // any exception propogate upwards.
1230 1224
1231 if (RootPart == null || UUID == UUID.Zero) 1225 if (IsDeleted || UUID == UUID.Zero)
1232 { 1226 {
1233// DetachFromBackup(); 1227// DetachFromBackup();
1234 return; 1228 return;
@@ -1932,8 +1926,8 @@ namespace OpenSim.Region.Environment.Scenes
1932 } 1926 }
1933 1927
1934 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 1928 m_scene.UnlinkSceneObject(objectGroup.UUID, true);
1935 objectGroup.Children.Clear(); 1929// objectGroup.Children.Clear();
1936 objectGroup.m_rootPart = null; 1930// objectGroup.m_rootPart = null;
1937 1931
1938 // TODO Deleting the original group object may cause problems later on if they have already 1932 // TODO Deleting the original group object may cause problems later on if they have already
1939 // made it into the update queue. However, sending out updates for those parts is now 1933 // made it into the update queue. However, sending out updates for those parts is now
@@ -2803,6 +2797,7 @@ namespace OpenSim.Region.Environment.Scenes
2803 } 2797 }
2804 } 2798 }
2805 } 2799 }
2800
2806 public float GetMass() 2801 public float GetMass()
2807 { 2802 {
2808 float retmass = 0f; 2803 float retmass = 0f;
@@ -2815,11 +2810,12 @@ namespace OpenSim.Region.Environment.Scenes
2815 } 2810 }
2816 return retmass; 2811 return retmass;
2817 } 2812 }
2813
2818 public void CheckSculptAndLoad() 2814 public void CheckSculptAndLoad()
2819 { 2815 {
2820 lock (m_parts) 2816 lock (m_parts)
2821 { 2817 {
2822 if (RootPart != null) 2818 if (!IsDeleted)
2823 { 2819 {
2824 if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == 0) 2820 if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == 0)
2825 { 2821 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index a02840c..74fa725 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -492,7 +492,7 @@ namespace OpenSim.Region.Environment.Scenes
492 StoreUndoState(); 492 StoreUndoState();
493 m_offsetPosition = value; 493 m_offsetPosition = value;
494 494
495 if (ParentGroup != null && ParentGroup.RootPart != null) 495 if (ParentGroup != null && !ParentGroup.IsDeleted)
496 { 496 {
497 if (_parentID != 0 && PhysActor != null) 497 if (_parentID != 0 && PhysActor != null)
498 { 498 {
@@ -1326,7 +1326,7 @@ if (m_shape != null) {
1326 { 1326 {
1327 if (m_parentGroup == null) 1327 if (m_parentGroup == null)
1328 return false; 1328 return false;
1329 if (m_parentGroup.RootPart == null) 1329 if (m_parentGroup.IsDeleted)
1330 return false; 1330 return false;
1331 1331
1332 return m_parentGroup.RootPart.DIE_AT_EDGE; 1332 return m_parentGroup.RootPart.DIE_AT_EDGE;
@@ -1604,7 +1604,7 @@ if (m_shape != null) {
1604 } 1604 }
1605 if (m_parentGroup == null) 1605 if (m_parentGroup == null)
1606 return; 1606 return;
1607 if (m_parentGroup.RootPart == null) 1607 if (m_parentGroup.IsDeleted)
1608 return; 1608 return;
1609 1609
1610 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) 1610 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
@@ -2251,7 +2251,7 @@ if (m_shape != null) {
2251 { 2251 {
2252 if (m_parentGroup == null) 2252 if (m_parentGroup == null)
2253 return; 2253 return;
2254 if (m_parentGroup.RootPart == null) 2254 if (m_parentGroup.IsDeleted)
2255 return; 2255 return;
2256 2256
2257 m_parentGroup.RootPart.DIE_AT_EDGE = p; 2257 m_parentGroup.RootPart.DIE_AT_EDGE = p;
@@ -3022,7 +3022,7 @@ if (m_shape != null) {
3022 DoPhysicsPropertyUpdate(UsePhysics, false); 3022 DoPhysicsPropertyUpdate(UsePhysics, false);
3023 if (m_parentGroup != null) 3023 if (m_parentGroup != null)
3024 { 3024 {
3025 if (m_parentGroup.RootPart != null) 3025 if (!m_parentGroup.IsDeleted)
3026 { 3026 {
3027 if (LocalId == m_parentGroup.RootPart.LocalId) 3027 if (LocalId == m_parentGroup.RootPart.LocalId)
3028 { 3028 {
@@ -3070,7 +3070,7 @@ if (m_shape != null) {
3070 DoPhysicsPropertyUpdate(UsePhysics, true); 3070 DoPhysicsPropertyUpdate(UsePhysics, true);
3071 if (m_parentGroup != null) 3071 if (m_parentGroup != null)
3072 { 3072 {
3073 if (m_parentGroup.RootPart != null) 3073 if (!m_parentGroup.IsDeleted)
3074 { 3074 {
3075 if (LocalId == m_parentGroup.RootPart.LocalId) 3075 if (LocalId == m_parentGroup.RootPart.LocalId)
3076 { 3076 {
@@ -3086,7 +3086,7 @@ if (m_shape != null) {
3086 DoPhysicsPropertyUpdate(UsePhysics, false); 3086 DoPhysicsPropertyUpdate(UsePhysics, false);
3087 if (m_parentGroup != null) 3087 if (m_parentGroup != null)
3088 { 3088 {
3089 if (m_parentGroup.RootPart != null) 3089 if (!m_parentGroup.IsDeleted)
3090 { 3090 {
3091 if (LocalId == m_parentGroup.RootPart.LocalId) 3091 if (LocalId == m_parentGroup.RootPart.LocalId)
3092 { 3092 {
@@ -3341,7 +3341,7 @@ if (m_shape != null) {
3341 3341
3342 public void SendTerseUpdateToClient(IClientAPI remoteClient) 3342 public void SendTerseUpdateToClient(IClientAPI remoteClient)
3343 { 3343 {
3344 if (ParentGroup == null || ParentGroup.RootPart == null) 3344 if (ParentGroup == null || ParentGroup.IsDeleted)
3345 return; 3345 return;
3346 3346
3347 Vector3 lPos = OffsetPosition; 3347 Vector3 lPos = OffsetPosition;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index c91027c..935c51b 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -637,8 +637,10 @@ namespace OpenSim.Region.Environment.Scenes
637 while (m_partsUpdateQueue.Count > 0) 637 while (m_partsUpdateQueue.Count > 0)
638 { 638 {
639 SceneObjectPart part = m_partsUpdateQueue.Dequeue(); 639 SceneObjectPart part = m_partsUpdateQueue.Dequeue();
640 if (part.ParentGroup == null || part.ParentGroup.RootPart == null) 640
641 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
641 continue; 642 continue;
643
642 if (m_updateTimes.ContainsKey(part.UUID)) 644 if (m_updateTimes.ContainsKey(part.UUID))
643 { 645 {
644 ScenePartUpdate update = m_updateTimes[part.UUID]; 646 ScenePartUpdate update = m_updateTimes[part.UUID];
@@ -2582,10 +2584,8 @@ namespace OpenSim.Region.Environment.Scenes
2582 if (gobj == null) 2584 if (gobj == null)
2583 return false; 2585 return false;
2584 2586
2585 if (gobj.RootPart == null) 2587 if (gobj.IsDeleted)
2586 {
2587 return false; 2588 return false;
2588 }
2589 } 2589 }
2590 } 2590 }
2591 return true; 2591 return true;
@@ -2598,7 +2598,7 @@ namespace OpenSim.Region.Environment.Scenes
2598 // Validate 2598 // Validate
2599 foreach (SceneObjectGroup gobj in m_attachments) 2599 foreach (SceneObjectGroup gobj in m_attachments)
2600 { 2600 {
2601 if (gobj == null || gobj.RootPart == null) 2601 if (gobj == null || gobj.IsDeleted)
2602 return false; 2602 return false;
2603 } 2603 }
2604 2604