diff --git a/src/BizHawk.Client.Common/movie/MovieSession.cs b/src/BizHawk.Client.Common/movie/MovieSession.cs index 452c3b0306..c0750dcdd4 100644 --- a/src/BizHawk.Client.Common/movie/MovieSession.cs +++ b/src/BizHawk.Client.Common/movie/MovieSession.cs @@ -277,6 +277,11 @@ namespace BizHawk.Client.Common _modeChangedCallback(); } + if (Movie is IDisposable d) + { + d.Dispose(); + } + Movie = null; } diff --git a/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs b/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs index 9287fe0a53..33bfb4da11 100644 --- a/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs +++ b/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs @@ -6,7 +6,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Client.Common { - public interface ITasMovie : IMovie, INotifyPropertyChanged + public interface ITasMovie : IMovie, INotifyPropertyChanged, IDisposable { bool BindMarkersToInput { get; set; } bool LastPositionStable { get; set; } diff --git a/src/BizHawk.Client.Common/movie/tasproj/IStateManager.cs b/src/BizHawk.Client.Common/movie/tasproj/IStateManager.cs index 86cc34298a..46126a1abb 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/IStateManager.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/IStateManager.cs @@ -1,10 +1,11 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common { - public interface IStateManager + public interface IStateManager : IDisposable { /// /// Retrieves the savestate for the given frame, diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 1357dd2f63..7642d6f08d 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -350,5 +350,11 @@ namespace BizHawk.Client.Common return Markers.Any(m => m.Frame - 1 == frame) || Branches.Any(b => b.Frame == frame); // Branches should already be in the reserved list, but it doesn't hurt to check } + + public void Dispose() + { + TasStateManager?.Dispose(); + TasStateManager = null; + } } }