diff options
author | Justin Clark-Casey (justincc) | 2012-06-25 21:08:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-25 21:08:19 +0100 |
commit | 5301648cff6b451fef4cca0baf8cda1bdb1455a6 (patch) | |
tree | 2877e517397265037c0342570a75757dc9462be0 | |
parent | Fix script "Running" behavior (diff) | |
download | opensim-SC_OLD-5301648cff6b451fef4cca0baf8cda1bdb1455a6.zip opensim-SC_OLD-5301648cff6b451fef4cca0baf8cda1bdb1455a6.tar.gz opensim-SC_OLD-5301648cff6b451fef4cca0baf8cda1bdb1455a6.tar.bz2 opensim-SC_OLD-5301648cff6b451fef4cca0baf8cda1bdb1455a6.tar.xz |
In AttachmentsModule.DetachSingleAttachmentToInvInternal(), remove attachment before changing properties for correct inventory serialization.
Serialization of attachments requires IsAttachment = false so that correct positions are serialized instead of avatar position.
However, doing this when a hud is still attached allows race conditions with update threads, resulting in hud artifacts on other viewers.
This change sets SOG.IsDeleted before serialization changes take place (IsDeleted itself is not a serialized property).
LLClientView then screens out any deleted SOGs before sending updates to viewers.
3 files changed, 42 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4cb7a3a..8874585 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3808,6 +3808,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3808 | && part.ParentGroup.HasPrivateAttachmentPoint | 3808 | && part.ParentGroup.HasPrivateAttachmentPoint |
3809 | && part.ParentGroup.AttachedAvatar != AgentId) | 3809 | && part.ParentGroup.AttachedAvatar != AgentId) |
3810 | continue; | 3810 | continue; |
3811 | |||
3812 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3813 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3814 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3815 | // of the test above). | ||
3816 | // | ||
3817 | // Actual deletions (kills) happen in another method. | ||
3818 | if (part.ParentGroup.IsDeleted) | ||
3819 | continue; | ||
3811 | } | 3820 | } |
3812 | 3821 | ||
3813 | objectUpdateBlocks.Value.Add(updateBlock); | 3822 | objectUpdateBlocks.Value.Add(updateBlock); |
@@ -3815,7 +3824,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3815 | } | 3824 | } |
3816 | else if (!canUseImproved) | 3825 | else if (!canUseImproved) |
3817 | { | 3826 | { |
3818 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); | 3827 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3828 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3829 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3830 | |||
3831 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3832 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3833 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3834 | // of the test above). | ||
3835 | // | ||
3836 | // Actual deletions (kills) happen in another method. | ||
3837 | if (part.ParentGroup.IsDeleted) | ||
3838 | continue; | ||
3839 | |||
3840 | compressedUpdateBlocks.Value.Add(compressedBlock); | ||
3819 | compressedUpdates.Value.Add(update); | 3841 | compressedUpdates.Value.Add(update); |
3820 | } | 3842 | } |
3821 | else | 3843 | else |
@@ -3842,6 +3864,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3842 | && part.ParentGroup.HasPrivateAttachmentPoint | 3864 | && part.ParentGroup.HasPrivateAttachmentPoint |
3843 | && part.ParentGroup.AttachedAvatar != AgentId) | 3865 | && part.ParentGroup.AttachedAvatar != AgentId) |
3844 | continue; | 3866 | continue; |
3867 | |||
3868 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3869 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3870 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3871 | // of the test above). | ||
3872 | // | ||
3873 | // Actual deletions (kills) happen in another method. | ||
3874 | if (part.ParentGroup.IsDeleted) | ||
3875 | continue; | ||
3845 | } | 3876 | } |
3846 | 3877 | ||
3847 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | 3878 | terseUpdateBlocks.Value.Add(terseUpdateBlock); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a2b95eb..99e0153 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -628,6 +628,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
628 | { | 628 | { |
629 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 629 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
630 | sp.RemoveAttachment(group); | 630 | sp.RemoveAttachment(group); |
631 | m_scene.DeleteSceneObject(group, false); | ||
631 | 632 | ||
632 | // Prepare sog for storage | 633 | // Prepare sog for storage |
633 | group.AttachedAvatar = UUID.Zero; | 634 | group.AttachedAvatar = UUID.Zero; |
@@ -636,7 +637,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
636 | group.AbsolutePosition = group.RootPart.AttachedPos; | 637 | group.AbsolutePosition = group.RootPart.AttachedPos; |
637 | 638 | ||
638 | UpdateKnownItem(sp, group, true); | 639 | UpdateKnownItem(sp, group, true); |
639 | m_scene.DeleteSceneObject(group, false); | ||
640 | 640 | ||
641 | return; | 641 | return; |
642 | } | 642 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 453e077..81add43 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -187,8 +187,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
187 | 187 | ||
188 | TestScene scene = new SceneHelpers().SetupScene(); | 188 | TestScene scene = new SceneHelpers().SetupScene(); |
189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
190 | |||
191 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | ||
192 | |||
190 | scene.DeleteSceneObject(part.ParentGroup, false); | 193 | scene.DeleteSceneObject(part.ParentGroup, false); |
191 | 194 | ||
195 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | ||
196 | |||
192 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 197 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
193 | Assert.That(retrievedPart, Is.Null); | 198 | Assert.That(retrievedPart, Is.Null); |
194 | } | 199 | } |
@@ -219,8 +224,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
219 | 224 | ||
220 | Assert.That(retrievedPart, Is.Not.Null); | 225 | Assert.That(retrievedPart, Is.Not.Null); |
221 | 226 | ||
227 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | ||
228 | |||
222 | sogd.InventoryDeQueueAndDelete(); | 229 | sogd.InventoryDeQueueAndDelete(); |
223 | 230 | ||
231 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | ||
232 | |||
224 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); | 233 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); |
225 | Assert.That(retrievedPart2, Is.Null); | 234 | Assert.That(retrievedPart2, Is.Null); |
226 | } | 235 | } |