From eee9c114cbcfdefba2b2edc94d4d174689c5d546 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 3 Sep 2008 19:28:46 +0000 Subject: [PATCH] Mantis #2111 Eliminate gretuitious KillObject packets. KillObject is sent to the viewer for the root part only. Also prevents the full update on deselect that makes a deleted object reappear and stay visible until the background deleter got around to it. We still send 2 KillObject packets for the root prim, that could be avoided only at a cost in reliability. One packet seems an acceptable price to pay for consistency. --- OpenSim/Region/Environment/Scenes/Scene.cs | 9 +++++++++ .../Environment/Scenes/SceneObjectGroup.cs | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2b242fc951..45062eb129 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2496,6 +2496,15 @@ namespace OpenSim.Region.Environment.Scenes public void SendKillObject(uint localID) { + SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null) // It is a prim + { + if (part.ParentGroup != null && part.ParentGroup.RootPart != null) // Valid + { + if (part.ParentGroup.RootPart != part) // Child part + return; + } + } Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 9c3d6a7491..a86beae21c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Environment.Scenes /// protected Dictionary m_parts = new Dictionary(); + private bool m_deleted = false; protected ulong m_regionHandle; protected SceneObjectPart m_rootPart; // private Dictionary m_scriptEvents = new Dictionary(); @@ -948,7 +949,8 @@ namespace OpenSim.Region.Environment.Scenes avatars[i].StandUp(); } - avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); + if (m_rootPart != null && part == m_rootPart) + avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } } @@ -959,6 +961,8 @@ namespace OpenSim.Region.Environment.Scenes public void FakeDeleteGroup() { + m_deleted = true; + foreach (SceneObjectPart part in m_parts.Values) { List avatars = Scene.GetScenePresences(); @@ -969,7 +973,8 @@ namespace OpenSim.Region.Environment.Scenes avatars[i].StandUp(); } - avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); + if (m_rootPart != null && part == m_rootPart) + avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } } } @@ -1543,6 +1548,16 @@ namespace OpenSim.Region.Environment.Scenes /// public void ScheduleGroupForFullUpdate() { + // If we wre in the delete queue, this will be set + // A full update now would make the prim reappear + // after KillObject was sent via FakeDeleteGroup + // causing flickering and delays in deletion. + // This leads to users clicking delete multiple times + // which can crash the session. So, avoid it. + // + if (m_deleted) + return; + checkAtTargets(); lock (m_parts) {