diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 3d53d974e..fbcc60df3 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -81,13 +81,25 @@ public class WindowSystem if (!this.windows.Contains(window)) throw new ArgumentException("This window is not registered on this WindowSystem."); + if (window is IDisposable disposable) + disposable.Dispose(); + this.windows.Remove(window); } /// /// Remove all windows from this . /// - public void RemoveAllWindows() => this.windows.Clear(); + public void RemoveAllWindows() + { + foreach (var window in this.windows) + { + if (window is IDisposable disposable) + disposable.Dispose(); + } + + this.windows.Clear(); + } /// /// Get a window by name.