diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 45db5f7b5c..1603c52132 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -311,8 +311,19 @@ namespace OpenSim.Region.Environment.Scenes public string ToXmlString() { - StringWriter sw = new StringWriter(); - XmlTextWriter writer = new XmlTextWriter(sw); + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + ToXml(writer); + } + + return sw.ToString(); + } + } + + public void ToXml(XmlTextWriter writer) + { writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); writer.WriteStartElement(String.Empty, "RootPart", String.Empty); m_rootPart.ToXml(writer); @@ -329,8 +340,6 @@ namespace OpenSim.Region.Environment.Scenes } writer.WriteEndElement(); writer.WriteEndElement(); - writer.Close(); - return sw.ToString(); } #region Copying diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 22408d3063..1004e62011 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -22,7 +22,8 @@ namespace OpenSim.Region.Environment.Scenes private string m_inventoryFileName = ""; private LLUUID m_folderID = LLUUID.Zero; - [XmlIgnore] public PhysicsActor PhysActor = null; + [XmlIgnore] + public PhysicsActor PhysActor = null; protected Dictionary TaskInventory = new Dictionary();