1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:23:02 +08:00

Fix drawable channels remaining in memory after being closed (#5607)

Fix drawable channels remaining in memory after being closed
This commit is contained in:
Dean Herbert 2019-08-06 22:58:14 +09:00 committed by GitHub
commit e3f88a83a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,6 +256,9 @@ namespace osu.Game.Overlays
loadedChannels.Add(loaded);
LoadComponentAsync(loaded, l =>
{
if (currentChannel.Value != e.NewValue)
return;
loading.Hide();
currentChannelContainer.Clear(false);
@ -381,7 +384,18 @@ namespace osu.Game.Overlays
foreach (Channel channel in channels)
{
ChannelTabControl.RemoveChannel(channel);
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
var loaded = loadedChannels.Find(c => c.Channel == channel);
if (loaded != null)
{
loadedChannels.Remove(loaded);
// Because the container is only cleared in the async load callback of a new channel, it is forcefully cleared
// to ensure that the previous channel doesn't get updated after it's disposed
currentChannelContainer.Remove(loaded);
loaded.Dispose();
}
}
}