mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 11:57:03 +08:00
Fix deletion persistence when freshly delinked prims are removed
Previously, Scene.Inventory.DeRezObjects() forced the persistence of prims before deletion. This is necessary so that freshly delinked prims can be deleted (otherwise they remain as parts of their old group and reappear on server restart). However, DeRezObjects() deleted to user inventory, which is required by llDie() or direct region module unlink and deletion. Therefore, forced persistence has been pushed down into Scene.UnlinkSceneObject() to be more general, this is still on the DeRezObjects() path. Uncommented TestDelinkPersistence() since this now passes. Tests required considerable elaboration of MockRegionDataPlugin to reflect underlying storing of parts.
This commit is contained in:
@@ -2092,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// rootPart.PhysActor = null;
|
||||
// }
|
||||
|
||||
if (UnlinkSceneObject(group.UUID, false))
|
||||
if (UnlinkSceneObject(group, false))
|
||||
{
|
||||
EventManager.TriggerObjectBeingRemovedFromScene(group);
|
||||
EventManager.TriggerParcelPrimCountTainted();
|
||||
@@ -2107,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
|
||||
/// object itself is not destroyed.
|
||||
/// </summary>
|
||||
/// <param name="uuid">Id of object.</param>
|
||||
/// <param name="so">The scene object.</param>
|
||||
/// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param>
|
||||
/// <returns>true if the object was in the scene, false if it was not</returns>
|
||||
/// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param>
|
||||
public bool UnlinkSceneObject(UUID uuid, bool softDelete)
|
||||
public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
|
||||
{
|
||||
if (m_sceneGraph.DeleteSceneObject(uuid, softDelete))
|
||||
if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
|
||||
{
|
||||
if (!softDelete)
|
||||
{
|
||||
m_storageManager.DataStore.RemoveObject(uuid,
|
||||
m_regInfo.RegionID);
|
||||
// Force a database update so that the scene object group ID is accurate. It's possible that the
|
||||
// group has recently been delinked from another group but that this change has not been persisted
|
||||
// to the DB.
|
||||
ForceSceneObjectBackup(so);
|
||||
so.DetachFromBackup();
|
||||
m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
|
||||
}
|
||||
|
||||
// We need to keep track of this state in case this group is still queued for further backup.
|
||||
so.IsDeleted = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2149,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
|
||||
m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2166,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
|
||||
m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user