mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Fix drawable channels remaining in memory after being closed
This commit is contained in:
parent
bf0f6e1053
commit
11916782ba
@ -256,6 +256,9 @@ namespace osu.Game.Overlays
|
|||||||
loadedChannels.Add(loaded);
|
loadedChannels.Add(loaded);
|
||||||
LoadComponentAsync(loaded, l =>
|
LoadComponentAsync(loaded, l =>
|
||||||
{
|
{
|
||||||
|
if (currentChannel.Value != e.NewValue)
|
||||||
|
return;
|
||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
currentChannelContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
@ -381,7 +384,18 @@ namespace osu.Game.Overlays
|
|||||||
foreach (Channel channel in channels)
|
foreach (Channel channel in channels)
|
||||||
{
|
{
|
||||||
ChannelTabControl.RemoveChannel(channel);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user