From 2240e2c39c7b1bf3ebe846b3d8c40119086b0e58 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 10 Jun 2021 17:23:15 +0300 Subject: [PATCH] Refrain from attempting to clear skin sources in disposal `Drawable.Dispose` is usually in an asynchronous context (async disposals stuff) and therefore this could cause a "collection was modified; enumeration opeartion may not execute" exception. --- osu.Game/Skinning/SkinProvidingContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/SkinProvidingContainer.cs b/osu.Game/Skinning/SkinProvidingContainer.cs index 74a465a91f..078c666472 100644 --- a/osu.Game/Skinning/SkinProvidingContainer.cs +++ b/osu.Game/Skinning/SkinProvidingContainer.cs @@ -210,7 +210,8 @@ protected override void Dispose(bool isDisposing) if (fallbackSource != null) fallbackSource.SourceChanged -= OnSourceChanged; - SkinSources.Clear(); + foreach (var source in SkinSources.OfType()) + source.SourceChanged -= OnSourceChanged; } private class NoFallbackProxy : ISkinSource