Add some locking on m_undo in SceneObjectPart

0.6.0-stable
Melanie Thielker 2008-08-17 19:17:44 +00:00
parent 5d6a42a22e
commit fe1d78bb78
1 changed files with 25 additions and 15 deletions

View File

@ -1177,7 +1177,10 @@ namespace OpenSim.Region.Environment.Scenes
public void ClearUndoState() public void ClearUndoState()
{ {
m_undo.Clear(); lock(m_undo)
{
m_undo.Clear();
}
StoreUndoState(); StoreUndoState();
} }
@ -2446,22 +2449,26 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
if (m_undo.Count > 0) lock(m_undo)
{ {
UndoState last = m_undo.Peek(); if (m_undo.Count > 0)
if (last != null)
{ {
if (last.Compare(this)) UndoState last = m_undo.Peek();
return; if (last != null)
{
if (last.Compare(this))
return;
}
} }
}
if (m_parentGroup.GetSceneMaxUndo() > 0) if (m_parentGroup.GetSceneMaxUndo() > 0)
{ {
UndoState nUndo = new UndoState(this); UndoState nUndo = new UndoState(this);
m_undo.Push(nUndo); m_undo.Push(nUndo);
}
} }
} }
@ -2951,11 +2958,14 @@ namespace OpenSim.Region.Environment.Scenes
public void Undo() public void Undo()
{ {
if (m_undo.Count > 0) lock(m_undo)
{ {
UndoState goback = m_undo.Pop(); if (m_undo.Count > 0)
if (goback != null) {
goback.PlaybackState(this); UndoState goback = m_undo.Pop();
if (goback != null)
goback.PlaybackState(this);
}
} }
} }