File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/BizHawk.Client.Common/movie/tasproj Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,16 @@ private class UndoItem
9999 public List < IMovieAction > actions ;
100100 public string name ;
101101 public int id ;
102+
103+ public UndoItem Clone ( )
104+ {
105+ return new ( )
106+ {
107+ actions = new ( this . actions ) ,
108+ name = this . name ,
109+ id = this . id ,
110+ } ;
111+ }
102112 }
103113
104114 private List < UndoItem > _history = new ( ) ;
@@ -316,7 +326,12 @@ public IMovieChangeLog Clone()
316326 {
317327 TasMovieChangeLog newLog = ( TasMovieChangeLog ) this . MemberwiseClone ( ) ;
318328 // The history list is the only thing that needs more than a shallow copy from MemberwiseClone.
319- newLog . _history = new ( _history ) ;
329+ newLog . _history = new ( ) ;
330+ // Clone each UndoItem because they can be mutated by MergeActions.
331+ foreach ( UndoItem item in this . _history )
332+ {
333+ newLog . _history . Add ( item . Clone ( ) ) ;
334+ }
320335 return newLog ;
321336 }
322337
You can’t perform that action at this time.
0 commit comments