aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-09-29 23:16:01 +0100
committerJustin Clark-Casey (justincc)2014-10-02 22:30:44 +0100
commit2a9528fa225214557dac59fb9259086c5d99fbb6 (patch)
tree987f79be5b0972857ca468ecb3e4cdd1756ccb17 /OpenSim/Region
parentDo not add attachments to the region scene object backup list. (diff)
downloadopensim-SC_OLD-2a9528fa225214557dac59fb9259086c5d99fbb6.zip
opensim-SC_OLD-2a9528fa225214557dac59fb9259086c5d99fbb6.tar.gz
opensim-SC_OLD-2a9528fa225214557dac59fb9259086c5d99fbb6.tar.bz2
opensim-SC_OLD-2a9528fa225214557dac59fb9259086c5d99fbb6.tar.xz
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs12
2 files changed, 18 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 7333769..609c559 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -387,7 +387,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
387 if (!Enabled) 387 if (!Enabled)
388 return false; 388 return false;
389 389
390 return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append); 390 group.DetachFromBackup();
391
392 bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
393
394 if (!success)
395 group.AttachToBackup();
396
397 return success;
391 } 398 }
392 399
393 /// <summary> 400 /// <summary>
@@ -815,8 +822,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
815 "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", 822 "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
816 so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); 823 so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
817 824
818 so.DetachFromBackup();
819
820 // Remove from database and parcel prim count 825 // Remove from database and parcel prim count
821 m_scene.DeleteFromStorage(so.UUID); 826 m_scene.DeleteFromStorage(so.UUID);
822 m_scene.EventManager.TriggerParcelPrimCountTainted(); 827 m_scene.EventManager.TriggerParcelPrimCountTainted();
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 4e58045..3bd7bee 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
199 string attName = "att"; 199 string attName = "att";
200 200
201 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); 201 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
202 Assert.That(so.Backup, Is.True);
202 203
203 m_numberOfAttachEventsFired = 0; 204 m_numberOfAttachEventsFired = 0;
204 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false); 205 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false);
@@ -213,6 +214,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
213 Assert.That(attSo.IsAttachment); 214 Assert.That(attSo.IsAttachment);
214 Assert.That(attSo.UsesPhysics, Is.False); 215 Assert.That(attSo.UsesPhysics, Is.False);
215 Assert.That(attSo.IsTemporary, Is.False); 216 Assert.That(attSo.IsTemporary, Is.False);
217 Assert.That(attSo.Backup, Is.False);
216 218
217 // Check item status 219 // Check item status
218 Assert.That( 220 Assert.That(
@@ -385,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
385 public void TestRezAttachmentFromInventory() 387 public void TestRezAttachmentFromInventory()
386 { 388 {
387 TestHelpers.InMethod(); 389 TestHelpers.InMethod();
388// log4net.Config.XmlConfigurator.Configure(); 390// TestHelpers.EnableLogging();
389 391
390 Scene scene = CreateTestScene(); 392 Scene scene = CreateTestScene();
391 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 393 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
@@ -407,6 +409,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
407 Assert.That(attSo.IsAttachment); 409 Assert.That(attSo.IsAttachment);
408 Assert.That(attSo.UsesPhysics, Is.False); 410 Assert.That(attSo.UsesPhysics, Is.False);
409 Assert.That(attSo.IsTemporary, Is.False); 411 Assert.That(attSo.IsTemporary, Is.False);
412 Assert.IsFalse(attSo.Backup);
410 413
411 // Check appearance status 414 // Check appearance status
412 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); 415 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
@@ -601,7 +604,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
601 Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); 604 Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
602 605
603 // Check object in scene 606 // Check object in scene
604 Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); 607 SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
608 Assert.That(soInScene, Is.Not.Null);
609 Assert.IsTrue(soInScene.Backup);
605 610
606 // Check events 611 // Check events
607 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); 612 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
@@ -755,6 +760,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
755 Assert.That(attSo.IsAttachment); 760 Assert.That(attSo.IsAttachment);
756 Assert.That(attSo.UsesPhysics, Is.False); 761 Assert.That(attSo.UsesPhysics, Is.False);
757 Assert.That(attSo.IsTemporary, Is.False); 762 Assert.That(attSo.IsTemporary, Is.False);
763 Assert.IsFalse(attSo.Backup);
758 764
759 // Check appearance status 765 // Check appearance status
760 List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments(); 766 List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
@@ -884,6 +890,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
884 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0]; 890 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
885 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); 891 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
886 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); 892 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
893 Assert.IsFalse(actualSceneBAtt.Backup);
887 894
888 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); 895 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
889 896
@@ -994,6 +1001,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
994 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0]; 1001 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
995 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); 1002 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
996 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); 1003 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
1004 Assert.IsFalse(actualSceneBAtt.Backup);
997 1005
998 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); 1006 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
999 1007