allocate UndoRedoStore only on demand

avinationmerge
UbitUmarov 2012-03-12 07:50:14 +00:00
parent b5e172677d
commit a35e00e81e
1 changed files with 17 additions and 10 deletions

View File

@ -263,7 +263,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_occupied; // KF if any av is sitting on this prim
private string m_text = String.Empty;
private string m_touchName = String.Empty;
private UndoRedoState m_UndoRedo = new UndoRedoState(5);
private UndoRedoState m_UndoRedo = null;
private bool m_passTouches;
@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.Category = Category;
dupe.m_rezzed = m_rezzed;
dupe.m_UndoRedo = new UndoRedoState(5);
dupe.m_UndoRedo = null;
dupe.IgnoreUndoUpdate = false;
dupe.Undoing = false;
@ -3646,6 +3646,9 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreUndoState(ObjectChangeWhat what)
{
if (m_UndoRedo == null)
m_UndoRedo = new UndoRedoState(5);
lock (m_UndoRedo)
{
if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
@ -3662,18 +3665,19 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
lock (m_UndoRedo)
if (m_UndoRedo == null)
return 0;
return m_UndoRedo.Count;
}
}
public void Undo()
{
lock (m_UndoRedo)
{
if (Undoing || ParentGroup == null)
if (m_UndoRedo == null || Undoing || ParentGroup == null)
return;
lock (m_UndoRedo)
{
Undoing = true;
m_UndoRedo.Undo(this);
Undoing = false;
@ -3682,11 +3686,11 @@ namespace OpenSim.Region.Framework.Scenes
public void Redo()
{
lock (m_UndoRedo)
{
if (Undoing || ParentGroup == null)
if (m_UndoRedo == null || Undoing || ParentGroup == null)
return;
lock (m_UndoRedo)
{
Undoing = true;
m_UndoRedo.Redo(this);
Undoing = false;
@ -3695,6 +3699,9 @@ namespace OpenSim.Region.Framework.Scenes
public void ClearUndoState()
{
if (m_UndoRedo == null || Undoing)
return;
lock (m_UndoRedo)
{
m_UndoRedo.Clear();