diff --git a/osu.Game/Skinning/SkinProvidingContainer.cs b/osu.Game/Skinning/SkinProvidingContainer.cs
index d2f38b58a4..a628e97578 100644
--- a/osu.Game/Skinning/SkinProvidingContainer.cs
+++ b/osu.Game/Skinning/SkinProvidingContainer.cs
@@ -44,7 +44,7 @@ public class SkinProvidingContainer : Container, ISkinSource
///
/// A dictionary mapping each source to a wrapper which handles lookup allowances.
///
- private readonly Dictionary skinSources = new Dictionary();
+ private readonly List<(ISkin skin, DisableableSkinSource wrapped)> skinSources = new List<(ISkin, DisableableSkinSource)>();
///
/// Constructs a new initialised with a single skin source.
@@ -70,7 +70,7 @@ protected SkinProvidingContainer()
/// The skin to add.
protected void AddSource(ISkin skin)
{
- skinSources.Add(skin, new DisableableSkinSource(skin, this));
+ skinSources.Add((skin, new DisableableSkinSource(skin, this)));
if (skin is ISkinSource source)
source.SourceChanged += TriggerSourceChanged;
@@ -82,7 +82,7 @@ protected void AddSource(ISkin skin)
/// The skin to remove.
protected void RemoveSource(ISkin skin)
{
- if (!skinSources.Remove(skin))
+ if (skinSources.RemoveAll(s => s.skin == skin) == 0)
return;
if (skin is ISkinSource source)
@@ -116,8 +116,8 @@ public IEnumerable AllSources
{
get
{
- foreach (var skin in skinSources.Keys)
- yield return skin;
+ foreach (var i in skinSources)
+ yield return i.skin;
if (AllowFallingBackToParent && ParentSource != null)
{
@@ -226,8 +226,11 @@ protected override void Dispose(bool isDisposing)
if (ParentSource != null)
ParentSource.SourceChanged -= TriggerSourceChanged;
- foreach (var source in skinSources.Keys.OfType())
- source.SourceChanged -= TriggerSourceChanged;
+ foreach (var i in skinSources)
+ {
+ if (i.skin is ISkinSource source)
+ source.SourceChanged -= TriggerSourceChanged;
+ }
}
private class DisableableSkinSource : ISkin