diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 957c4e8978..d0619d7ff1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5040,5 +5040,37 @@ namespace OpenSim.Region.Framework.Scenes throw new Exception(error); } } + + public void CleanDroppedAttachments() + { + List objectsToDelete = + new List(); + + ForEachSOG(delegate (SceneObjectGroup grp) + { + if (grp.RootPart.Shape.State != 0) + { + UUID agentID = grp.OwnerID; + if (agentID == UUID.Zero) + { + objectsToDelete.Add(grp); + return; + } + + ScenePresence sp = GetScenePresence(agentID); + if (sp == null) + { + objectsToDelete.Add(grp); + return; + } + } + }); + + foreach (SceneObjectGroup grp in objectsToDelete) + { + m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); + DeleteSceneObject(grp, true); + } + } } }