mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 13:17:22 +09:00
Ensure spectator player is unsubscribed to prevent leak
This commit is contained in:
parent
23d9fa4dfa
commit
716458344f
@ -26,12 +26,6 @@ namespace osu.Game.Screens.Play
|
|||||||
spectatorStreaming.OnUserBeganPlaying += userBeganPlaying;
|
spectatorStreaming.OnUserBeganPlaying += userBeganPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void userBeganPlaying(int userId, SpectatorState state)
|
|
||||||
{
|
|
||||||
if (userId == Score.ScoreInfo.UserID)
|
|
||||||
Schedule(this.Exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
|
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
|
||||||
{
|
{
|
||||||
// if we already have frames, start gameplay at the point in time they exist, should they be too far into the beatmap.
|
// if we already have frames, start gameplay at the point in time they exist, should they be too far into the beatmap.
|
||||||
@ -42,5 +36,25 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
return new GameplayClockContainer(beatmap, firstFrameTime.Value, true);
|
return new GameplayClockContainer(beatmap, firstFrameTime.Value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool OnExiting(IScreen next)
|
||||||
|
{
|
||||||
|
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
|
||||||
|
return base.OnExiting(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (spectatorStreaming != null)
|
||||||
|
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void userBeganPlaying(int userId, SpectatorState state)
|
||||||
|
{
|
||||||
|
if (userId == Score.ScoreInfo.UserID)
|
||||||
|
Schedule(this.Exit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user