* Remove a bug I created in r5171 where taking an object would terminate the client session

* change code to use an explicit state variable instead of using SOG.Name = null to signal deletion
0.6.0-stable
Justin Clarke Casey 2008-06-21 19:56:19 +00:00
parent ff56cb730b
commit b290ce405f
6 changed files with 40 additions and 14 deletions

View File

@ -31,6 +31,7 @@ using OpenSim.Region.Environment.Modules.World.Serialiser;
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Xml;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
@ -101,6 +102,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Loading prim data"); m_log.InfoFormat("[ARCHIVER]: Loading prim data");
IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
// Temporary code to read each sog in the file separately, pending actually having these in separate files
// XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims));
// XmlDocument doc = new XmlDocument();
// reader.WhitespaceHandling = WhitespaceHandling.None;
// doc.Load(xtr);
// xtr.Close();
// XmlNode sceneNode = doc.FirstChild;
//
// foreach (XmlNode objectNode in sceneNode.ChildNodes)
// {
// CreatePrimFromXml2(m_scene, objectNode.OuterXml);
// }
serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims));
} }
} }

View File

@ -114,6 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
doc.Load(reader); doc.Load(reader);
reader.Close(); reader.Close();
rootNode = doc.FirstChild; rootNode = doc.FirstChild;
foreach (XmlNode aPrimNode in rootNode.ChildNodes) foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{ {
CreatePrimFromXml2(scene, aPrimNode.OuterXml); CreatePrimFromXml2(scene, aPrimNode.OuterXml);

View File

@ -64,6 +64,15 @@ namespace OpenSim.Region.Environment.Scenes
set { m_name = value; } set { m_name = value; }
} }
/// <summary>
/// Signals whether this group was in a scene but has since been deleted from it.
/// </summary>
public bool IsDeleted
{
get { return m_isDeleted; }
}
protected bool m_isDeleted;
protected LLVector3 m_pos; protected LLVector3 m_pos;
/// <summary> /// <summary>

View File

@ -293,21 +293,23 @@ namespace OpenSim.Region.Environment.Scenes
// Don't abort the whole update if one entity happens to give us an exception. // Don't abort the whole update if one entity happens to give us an exception.
try try
{ {
// A null name signals that this group was deleted before the scheduled update // Check that the group was not deleted before the scheduled update
// FIXME: This is merely a temporary measure to reduce the incidence of failure, when // FIXME: This is merely a temporary measure to reduce the incidence of failure, when
// an object has been deleted from a scene before update was processed. // an object has been deleted from a scene before update was processed.
// A more fundamental overhaul of the update mechanism is required to eliminate all // A more fundamental overhaul of the update mechanism is required to eliminate all
// the race conditions. // the race conditions.
if (entity.Name != null) if (!entity.IsDeleted)
{ {
m_updateList[i].Update(); m_updateList[i].Update();
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e);//entity.m_uuid m_log.ErrorFormat(
"[INNER SCENE]: Failed to update {0}, {1} - {2}", entity.Name, entity.UUID, e);
} }
} }
m_updateList.Clear(); m_updateList.Clear();
} }
} }

View File

@ -1665,7 +1665,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Delete this object from the scene. /// Delete the given object from the scene.
/// </summary> /// </summary>
/// <param name="group"></param> /// <param name="group"></param>
public void DeleteSceneObject(SceneObjectGroup group) public void DeleteSceneObject(SceneObjectGroup group)
@ -1686,14 +1686,6 @@ namespace OpenSim.Region.Environment.Scenes
group.DeleteGroup(); group.DeleteGroup();
group.DeleteParts(); group.DeleteParts();
// In case anybody else retains a reference to this group, signal deletion by changing the name
// to null. We can't zero out the UUID because this is taken from the root part, which has already
// been removed.
// FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race
// conditions where a user deletes an entity while it is being stored. Really, the update
// code needs a redesign.
group.Name = null;
} }
/// <summary> /// <summary>

View File

@ -921,10 +921,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Completely delete this group and tell all the scene presences about that deletion. /// Delete this group from its scene and tell all the scene presences about that deletion.
/// </summary> /// </summary>
public void DeleteGroup() public void DeleteGroup()
{ {
// We need to keep track of this state in case this group is still queued for backup.
// FIXME: This is a poor temporary solution, since it still leaves plenty of scope for race
// conditions where a user deletes an entity while it is being stored. Really, the update
// code needs a redesign.
m_isDeleted = true;
DetachFromBackup(this); DetachFromBackup(this);
lock (m_parts) lock (m_parts)
@ -944,6 +950,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void FakeDeleteGroup() public void FakeDeleteGroup()
{ {
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)