diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dc58d84e45..c596baa9d6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2182,6 +2182,14 @@ namespace OpenSim.Region.Framework.Scenes /// Delete every object from the scene. This does not include attachments worn by avatars. /// public void DeleteAllSceneObjects() + { + DeleteAllSceneObjects(false); + } + + /// + /// Delete every object from the scene. This does not include attachments worn by avatars. + /// + public void DeleteAllSceneObjects(bool exceptNoCopy) { lock (Entities) { @@ -2192,8 +2200,13 @@ namespace OpenSim.Region.Framework.Scenes if (e is SceneObjectGroup) { SceneObjectGroup sog = (SceneObjectGroup)e; - if (!sog.IsAttachment) - DeleteSceneObject((SceneObjectGroup)e, false); + if (sog != null && !sog.IsAttachment) + { + if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) + { + DeleteSceneObject((SceneObjectGroup)e, false); + } + } } } }