* 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
0.6.1-post-fixes
Justin Clarke Casey 2008-11-21 18:33:09 +00:00
parent e261c97470
commit 7dce464113
2 changed files with 12 additions and 4 deletions

View File

@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
public IClientAPI remoteClient;
public SceneObjectGroup objectGroup;
public UUID folderID;
public bool permissionToDelete;
}
/// <summary>
@ -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)
{

View File

@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
}
}
}