Don't store undo states if a scene object is manipulated when it is not in a scene.

Adds regression test for this.
connector_plugin
Justin Clark-Casey (justincc) 2012-09-26 23:31:10 +01:00
parent 31c636f1e4
commit b9934fc4db
2 changed files with 26 additions and 3 deletions

View File

@ -3170,6 +3170,9 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreUndoState(bool forGroup) public void StoreUndoState(bool forGroup)
{ {
if (ParentGroup == null || ParentGroup.Scene == null)
return;
if (Undoing) if (Undoing)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -3183,9 +3186,6 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
if (ParentGroup == null)
return;
lock (m_undo) lock (m_undo)
{ {
if (m_undo.Count > 0) if (m_undo.Count > 0)

View File

@ -102,6 +102,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(g1.GroupScale, Is.EqualTo(secondSize)); Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
} }
[Test]
public void TestNoUndoOnObjectsNotInScene()
{
TestHelpers.InMethod();
Vector3 firstSize = new Vector3(2, 3, 4);
Vector3 secondSize = new Vector3(5, 6, 7);
Vector3 thirdSize = new Vector3(8, 9, 10);
Vector3 fourthSize = new Vector3(11, 12, 13);
Scene scene = new SceneHelpers().SetupScene();
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
g1.GroupResize(firstSize);
g1.GroupResize(secondSize);
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
g1.RootPart.Undo();
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
}
[Test] [Test]
public void TestUndoBeyondAvailable() public void TestUndoBeyondAvailable()
{ {