From 7dce4641138484c40586cdeb8d3f7bbf2e9da625 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 21 Nov 2008 18:33:09 +0000 Subject: * 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 --- .../Environment/Scenes/AsyncSceneObjectGroupDeleter.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs') 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 public IClientAPI remoteClient; public SceneObjectGroup objectGroup; public UUID folderID; + public bool permissionToDelete; } /// @@ -87,6 +88,7 @@ namespace OpenSim.Region.Environment.Scenes dtis.folderID = folderID; dtis.objectGroup = objectGroup; dtis.remoteClient = remoteClient; + dtis.permissionToDelete = permissionToDelete; m_inventoryDeletes.Enqueue(dtis); } @@ -94,8 +96,12 @@ namespace OpenSim.Region.Environment.Scenes if (Enabled) m_inventoryTicker.Start(); + // Visually remove it, even if it isnt really gone yet. This means that if we crash before the object + // has gone to inventory, it will reappear in the region again on restart instead of being lost. + // This is not ideal since the object will still be available for manipulation when it should be, but it's + // better than losing the object for now. if (permissionToDelete) - m_scene.DeleteSceneObject(objectGroup, false); + objectGroup.DeleteGroup(false); } private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) @@ -126,7 +132,9 @@ namespace OpenSim.Region.Environment.Scenes try { - m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); + m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); + if (x.permissionToDelete) + m_scene.DeleteSceneObject(x.objectGroup, false); } catch (Exception e) { -- cgit v1.1