aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-21 18:33:09 +0000
committerJustin Clarke Casey2008-11-21 18:33:09 +0000
commit7dce4641138484c40586cdeb8d3f7bbf2e9da625 (patch)
tree956156a5dcce2615889cc8b8724c0a1b2b7157ca /OpenSim/Region
parent* On delete to inventory, actually remove the group from the scene before the... (diff)
downloadopensim-SC-7dce4641138484c40586cdeb8d3f7bbf2e9da625.zip
opensim-SC-7dce4641138484c40586cdeb8d3f7bbf2e9da625.tar.gz
opensim-SC-7dce4641138484c40586cdeb8d3f7bbf2e9da625.tar.bz2
opensim-SC-7dce4641138484c40586cdeb8d3f7bbf2e9da625.tar.xz
* Largely revert the last revision and improve on the previous way of doing things
* Deleting the object before the async to inventory is bad since if OpenSim crashes (or is shutdown!) in the time inbetween, then the object is lost * Also now delete the object from the scene only after it has gone to inventory - in the old way there was still a race condition * This is still not ideal since the 'deleted' object remains in the scene and probably could be manipulated. But this is better than the alternative
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs4
2 files changed, 12 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
index 44c5a13..19ba5fa 100644
--- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 public IClientAPI remoteClient; 42 public IClientAPI remoteClient;
43 public SceneObjectGroup objectGroup; 43 public SceneObjectGroup objectGroup;
44 public UUID folderID; 44 public UUID folderID;
45 public bool permissionToDelete;
45 } 46 }
46 47
47 /// <summary> 48 /// <summary>
@@ -87,6 +88,7 @@ namespace OpenSim.Region.Environment.Scenes
87 dtis.folderID = folderID; 88 dtis.folderID = folderID;
88 dtis.objectGroup = objectGroup; 89 dtis.objectGroup = objectGroup;
89 dtis.remoteClient = remoteClient; 90 dtis.remoteClient = remoteClient;
91 dtis.permissionToDelete = permissionToDelete;
90 92
91 m_inventoryDeletes.Enqueue(dtis); 93 m_inventoryDeletes.Enqueue(dtis);
92 } 94 }
@@ -94,8 +96,12 @@ namespace OpenSim.Region.Environment.Scenes
94 if (Enabled) 96 if (Enabled)
95 m_inventoryTicker.Start(); 97 m_inventoryTicker.Start();
96 98
99 // Visually remove it, even if it isnt really gone yet. This means that if we crash before the object
100 // has gone to inventory, it will reappear in the region again on restart instead of being lost.
101 // This is not ideal since the object will still be available for manipulation when it should be, but it's
102 // better than losing the object for now.
97 if (permissionToDelete) 103 if (permissionToDelete)
98 m_scene.DeleteSceneObject(objectGroup, false); 104 objectGroup.DeleteGroup(false);
99 } 105 }
100 106
101 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) 107 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
@@ -126,7 +132,9 @@ namespace OpenSim.Region.Environment.Scenes
126 132
127 try 133 try
128 { 134 {
129 m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); 135 m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient);
136 if (x.permissionToDelete)
137 m_scene.DeleteSceneObject(x.objectGroup, false);
130 } 138 }
131 catch (Exception e) 139 catch (Exception e)
132 { 140 {
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
index e0d6a99..1cc95fc 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
@@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests
97 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); 97 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
98 scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); 98 scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero);
99 99
100 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 100 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
101 Assert.That(retrievedPart, Is.Null); 101 Assert.That(retrievedPart, Is.Not.Null);
102 } 102 }
103 } 103 }
104} \ No newline at end of file 104} \ No newline at end of file