aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-26 22:49:44 +0100
committerJustin Clark-Casey (justincc)2012-09-26 22:49:44 +0100
commit327320d1a7acbba969d26c281f92f64ce8ff365f (patch)
treefe6709dba92015f98cd173f8d2873ed44c4a5d3b /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-327320d1a7acbba969d26c281f92f64ce8ff365f.zip
opensim-SC_OLD-327320d1a7acbba969d26c281f92f64ce8ff365f.tar.gz
opensim-SC_OLD-327320d1a7acbba969d26c281f92f64ce8ff365f.tar.bz2
opensim-SC_OLD-327320d1a7acbba969d26c281f92f64ce8ff365f.tar.xz
Enforce existing 5 action hardcoded undo limit.
This was present in the code but not enforced, which led to a memory leak over time as part properties were changed, whether by viewer, script or another source. This commit enforces that limit, which will soon become configurable. Regression test for undo limit added Should help with http://opensimulator.org/mantis/view.php?id=6279
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs59
1 files changed, 33 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 63eb387..9e78242 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -266,8 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
266 private string m_sitAnimation = "SIT"; 266 private string m_sitAnimation = "SIT";
267 private string m_text = String.Empty; 267 private string m_text = String.Empty;
268 private string m_touchName = String.Empty; 268 private string m_touchName = String.Empty;
269 private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); 269 private readonly List<UndoState> m_undo = new List<UndoState>(5);
270 private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5); 270 private readonly List<UndoState> m_redo = new List<UndoState>(5);
271 271
272 private bool m_passTouches = false; 272 private bool m_passTouches = false;
273 private bool m_passCollisions = false; 273 private bool m_passCollisions = false;
@@ -3176,7 +3176,7 @@ namespace OpenSim.Region.Framework.Scenes
3176 { 3176 {
3177 if (m_undo.Count > 0) 3177 if (m_undo.Count > 0)
3178 { 3178 {
3179 UndoState last = m_undo.Peek(); 3179 UndoState last = m_undo[m_undo.Count - 1];
3180 if (last != null) 3180 if (last != null)
3181 { 3181 {
3182 // TODO: May need to fix for group comparison 3182 // TODO: May need to fix for group comparison
@@ -3199,7 +3199,10 @@ namespace OpenSim.Region.Framework.Scenes
3199 { 3199 {
3200 UndoState nUndo = new UndoState(this, forGroup); 3200 UndoState nUndo = new UndoState(this, forGroup);
3201 3201
3202 m_undo.Push(nUndo); 3202 m_undo.Add(nUndo);
3203
3204 if (m_undo.Count > ParentGroup.GetSceneMaxUndo())
3205 m_undo.RemoveAt(0);
3203 3206
3204 if (m_redo.Count > 0) 3207 if (m_redo.Count > 0)
3205 m_redo.Clear(); 3208 m_redo.Clear();
@@ -3245,21 +3248,24 @@ namespace OpenSim.Region.Framework.Scenes
3245 3248
3246 if (m_undo.Count > 0) 3249 if (m_undo.Count > 0)
3247 { 3250 {
3248 UndoState goback = m_undo.Pop(); 3251 UndoState goback = m_undo[m_undo.Count - 1];
3252 m_undo.RemoveAt(m_undo.Count - 1);
3249 3253
3250 if (goback != null) 3254 UndoState nUndo = null;
3255
3256 if (ParentGroup.GetSceneMaxUndo() > 0)
3251 { 3257 {
3252 UndoState nUndo = null; 3258 nUndo = new UndoState(this, goback.ForGroup);
3253 3259 }
3254 if (ParentGroup.GetSceneMaxUndo() > 0) 3260
3255 { 3261 goback.PlaybackState(this);
3256 nUndo = new UndoState(this, goback.ForGroup);
3257 }
3258 3262
3259 goback.PlaybackState(this); 3263 if (nUndo != null)
3264 {
3265 m_redo.Add(nUndo);
3260 3266
3261 if (nUndo != null) 3267 if (m_redo.Count > ParentGroup.GetSceneMaxUndo())
3262 m_redo.Push(nUndo); 3268 m_redo.RemoveAt(0);
3263 } 3269 }
3264 } 3270 }
3265 3271
@@ -3279,20 +3285,21 @@ namespace OpenSim.Region.Framework.Scenes
3279 3285
3280 if (m_redo.Count > 0) 3286 if (m_redo.Count > 0)
3281 { 3287 {
3282 UndoState gofwd = m_redo.Pop(); 3288 UndoState gofwd = m_redo[m_redo.Count - 1];
3283 3289 m_redo.RemoveAt(m_redo.Count - 1);
3284 if (gofwd != null) 3290
3291 if (ParentGroup.GetSceneMaxUndo() > 0)
3285 { 3292 {
3286 if (ParentGroup.GetSceneMaxUndo() > 0) 3293 UndoState nUndo = new UndoState(this, gofwd.ForGroup);
3287 { 3294
3288 UndoState nUndo = new UndoState(this, gofwd.ForGroup); 3295 m_undo.Add(nUndo);
3289 3296
3290 m_undo.Push(nUndo); 3297 if (m_undo.Count > ParentGroup.GetSceneMaxUndo())
3291 } 3298 m_undo.RemoveAt(0);
3292
3293 gofwd.PlayfwdState(this);
3294 } 3299 }
3295 3300
3301 gofwd.PlayfwdState(this);
3302
3296// m_log.DebugFormat( 3303// m_log.DebugFormat(
3297// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", 3304// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
3298// Name, LocalId, m_redo.Count); 3305// Name, LocalId, m_redo.Count);