diff options
author | Justin Clarke Casey | 2008-11-21 18:17:01 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-21 18:17:01 +0000 |
commit | e261c974704098e5d1238ef800ef49d3ec7e75b8 (patch) | |
tree | 8caa0b40509a2dc70fca1061537573ac148cbcc6 | |
parent | * minor: Remove comparison of UUID struct against null picked up as a warning (diff) | |
download | opensim-SC-e261c974704098e5d1238ef800ef49d3ec7e75b8.zip opensim-SC-e261c974704098e5d1238ef800ef49d3ec7e75b8.tar.gz opensim-SC-e261c974704098e5d1238ef800ef49d3ec7e75b8.tar.bz2 opensim-SC-e261c974704098e5d1238ef800ef49d3ec7e75b8.tar.xz |
* On delete to inventory, actually remove the group from the scene before the async stage.
* Last time I accidentally left the existing code in place that merely wiped the group from the client (but not the scene)
* Put in an incomplete 'delete object o inventory' test to assert that this happens
3 files changed, 21 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index d92ff89..44c5a13 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -42,7 +42,6 @@ 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; | ||
46 | } | 45 | } |
47 | 46 | ||
48 | /// <summary> | 47 | /// <summary> |
@@ -88,7 +87,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
88 | dtis.folderID = folderID; | 87 | dtis.folderID = folderID; |
89 | dtis.objectGroup = objectGroup; | 88 | dtis.objectGroup = objectGroup; |
90 | dtis.remoteClient = remoteClient; | 89 | dtis.remoteClient = remoteClient; |
91 | dtis.permissionToDelete = permissionToDelete; | ||
92 | 90 | ||
93 | m_inventoryDeletes.Enqueue(dtis); | 91 | m_inventoryDeletes.Enqueue(dtis); |
94 | } | 92 | } |
@@ -96,9 +94,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
96 | if (Enabled) | 94 | if (Enabled) |
97 | m_inventoryTicker.Start(); | 95 | m_inventoryTicker.Start(); |
98 | 96 | ||
99 | // Visually remove it, even if it isnt really gone yet. | ||
100 | if (permissionToDelete) | 97 | if (permissionToDelete) |
101 | objectGroup.DeleteGroup(false); | 98 | m_scene.DeleteSceneObject(objectGroup, false); |
102 | } | 99 | } |
103 | 100 | ||
104 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) | 101 | private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) |
@@ -129,8 +126,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
129 | 126 | ||
130 | try | 127 | try |
131 | { | 128 | { |
132 | if (x.permissionToDelete) | ||
133 | m_scene.DeleteSceneObject(x.objectGroup, false); | ||
134 | m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); | 129 | m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); |
135 | } | 130 | } |
136 | catch (Exception e) | 131 | catch (Exception e) |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 66ea59e..e0d6a99 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs | |||
@@ -70,27 +70,35 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /// <summary> | 72 | /// <summary> |
73 | /// Test removing an object from a scene. | 73 | /// Test deleting an object from a scene. |
74 | /// </summary> | 74 | /// </summary> |
75 | [Test] | 75 | [Test] |
76 | public void TestRemoveSceneObject() | 76 | public void TestDeleteSceneObject() |
77 | { | 77 | { |
78 | TestScene scene = SceneTestUtils.SetupScene(); | 78 | TestScene scene = SceneTestUtils.SetupScene(); |
79 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); | 79 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); |
80 | scene.DeleteSceneObject(part.ParentGroup, false); | 80 | scene.DeleteSceneObject(part.ParentGroup, false); |
81 | 81 | ||
82 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 82 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
83 | |||
84 | Assert.That(retrievedPart, Is.Null); | 83 | Assert.That(retrievedPart, Is.Null); |
85 | } | 84 | } |
86 | 85 | ||
87 | /// <summary> | 86 | /// <summary> |
88 | /// Test removing an object | 87 | /// Test deleting an object to user inventory |
89 | /// </summary> | 88 | /// </summary> |
90 | public void TestRemoveSceneObjectAsync() | 89 | [Test] |
90 | public void TestDeleteSceneObjectToUserInventory() | ||
91 | { | 91 | { |
92 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
93 | |||
92 | TestScene scene = SceneTestUtils.SetupScene(); | 94 | TestScene scene = SceneTestUtils.SetupScene(); |
93 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); | 95 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); |
96 | |||
97 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); | ||
98 | scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); | ||
99 | |||
100 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
101 | Assert.That(retrievedPart, Is.Null); | ||
94 | } | 102 | } |
95 | } | 103 | } |
96 | } \ No newline at end of file | 104 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 31fe0b6..2589368 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
75 | /// <param name="scene"></param> | 75 | /// <param name="scene"></param> |
76 | /// <param name="agentId"></param> | 76 | /// <param name="agentId"></param> |
77 | /// <returns></returns> | 77 | /// <returns></returns> |
78 | public static void AddRootAgent(Scene scene, UUID agentId) | 78 | public static IClientAPI AddRootAgent(Scene scene, UUID agentId) |
79 | { | 79 | { |
80 | string firstName = "testfirstname"; | 80 | string firstName = "testfirstname"; |
81 | 81 | ||
@@ -92,7 +92,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
92 | agent.CapsPath = "http://wibble.com"; | 92 | agent.CapsPath = "http://wibble.com"; |
93 | 93 | ||
94 | scene.NewUserConnection(agent); | 94 | scene.NewUserConnection(agent); |
95 | scene.AddNewClient(new TestClient(agent), false); | 95 | IClientAPI client = new TestClient(agent); |
96 | scene.AddNewClient(client, false); | ||
97 | |||
98 | return client; | ||
96 | } | 99 | } |
97 | 100 | ||
98 | /// <summary> | 101 | /// <summary> |