Don't unnecessarily remove from backup objects that were not directly attached from the scene.

These are never in region backup in the first place since recent 11830c43
Extend regression test to check backup status.
mb-throttle-test
Justin Clark-Casey (justincc) 2014-09-29 23:16:01 +01:00
parent 57e75d7c03
commit 2a9528fa22
3 changed files with 19 additions and 6 deletions

View File

@ -387,7 +387,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!Enabled)
return false;
return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
group.DetachFromBackup();
bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
if (!success)
group.AttachToBackup();
return success;
}
/// <summary>
@ -815,8 +822,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
"[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
so.DetachFromBackup();
// Remove from database and parcel prim count
m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();

View File

@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
string attName = "att";
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
Assert.That(so.Backup, Is.True);
m_numberOfAttachEventsFired = 0;
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false);
@ -213,6 +214,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
Assert.That(attSo.Backup, Is.False);
// Check item status
Assert.That(
@ -385,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
public void TestRezAttachmentFromInventory()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// TestHelpers.EnableLogging();
Scene scene = CreateTestScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
@ -407,6 +409,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
Assert.IsFalse(attSo.Backup);
// Check appearance status
Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
@ -601,7 +604,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
// Check object in scene
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
Assert.That(soInScene, Is.Not.Null);
Assert.IsTrue(soInScene.Backup);
// Check events
Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
@ -755,6 +760,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
Assert.IsFalse(attSo.Backup);
// Check appearance status
List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
@ -884,6 +890,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
Assert.IsFalse(actualSceneBAtt.Backup);
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
@ -994,6 +1001,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
Assert.IsFalse(actualSceneBAtt.Backup);
Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));

View File

@ -611,7 +611,7 @@ namespace OpenSim.Tests.Common
//part.UpdatePrimFlags(false, false, true);
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
scene.AddNewSceneObject(so, false);
scene.AddNewSceneObject(so, true);
return so;
}