1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 20:05:29 +08:00

Ensure drawable channels removed from the cache are disposed

This commit is contained in:
Jai Sharma 2022-05-14 00:15:02 +01:00
parent f88e416d1a
commit 2163a78b7f

View File

@ -241,6 +241,7 @@ namespace osu.Game.Overlays
if (newChannel == null) if (newChannel == null)
{ {
// null channel denotes that we should be showing the listing. // null channel denotes that we should be showing the listing.
currentChannelContainer.Clear(false);
channelListing.State.Value = Visibility.Visible; channelListing.State.Value = Visibility.Visible;
textBar.ShowSearch.Value = true; textBar.ShowSearch.Value = true;
} }
@ -298,7 +299,13 @@ namespace osu.Game.Overlays
foreach (var channel in leftChannels) foreach (var channel in leftChannels)
{ {
channelList.RemoveChannel(channel); channelList.RemoveChannel(channel);
loadedChannels.Remove(channel); if (loadedChannels.ContainsKey(channel))
{
ChatOverlayDrawableChannel loaded = loadedChannels[channel];
loadedChannels.Remove(channel);
// DrawableChannel removed from cache must be manually disposed
loaded.Dispose();
}
} }
break; break;