1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-30 17:00:38 +08:00

Fix memory leak from Player's InputManager.

This commit is contained in:
Dean Herbert
2017-02-24 20:59:21 +09:00
Unverified
parent 65a24dfe5d
commit 5096f6b83d
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -222,6 +222,12 @@ namespace osu.Game.Screens.Play
if (IsPaused) Pause(); else Resume();
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
playerInputManager?.Dispose();
}
public void Restart()
{
sourceClock.Stop(); // If the clock is running and Restart is called the game will lag until relaunch
@@ -312,6 +318,9 @@ namespace osu.Game.Screens.Play
}
else
{
FadeOut(250);
Content.ScaleTo(0.7f, 750, EasingTypes.InQuint);
dimLevel.ValueChanged -= dimChanged;
Background?.FadeTo(1f, 200);
return base.OnExiting(next);
+6
View File
@@ -89,6 +89,12 @@ namespace osu.Game.Screens.Play
{
Content.ScaleTo(0.7f, 150, EasingTypes.InQuint);
FadeOut(150);
//this is required to clean up the InputManager in Player.
//can be removed once we solve that one.
if (player != null && player.LoadState != LoadState.Alive)
player.Dispose();
return base.OnExiting(next);
}