mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Fix UI Window Memory Leak in CloseRecentWindowUIController (#45399)
no leaking windows
This commit is contained in:
parent
8b4a0ff589
commit
68ec95f554
1 changed files with 9 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ public sealed partial class CloseRecentWindowUIController : UIController
|
|||
// (Does not need to be unlistened since UIControllers live forever)
|
||||
_uiManager.OnKeyBindDown += OnKeyBindDown;
|
||||
_uiManager.WindowRoot.OnChildAdded += OnRootChildAdded;
|
||||
_uiManager.WindowRoot.OnChildRemoved += OnRootChildRemoved;
|
||||
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.WindowCloseRecent,
|
||||
InputCmdHandler.FromDelegate(session => CloseMostRecentWindow()));
|
||||
|
|
@ -122,6 +123,14 @@ public sealed partial class CloseRecentWindowUIController : UIController
|
|||
}
|
||||
}
|
||||
|
||||
private void OnRootChildRemoved(Control control)
|
||||
{
|
||||
if (control is BaseWindow window)
|
||||
{
|
||||
recentlyInteractedWindows.Remove(window);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether there are any windows that can be closed.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue