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.
This commit is contained in:
Salman Ahmed 2021-06-10 17:23:15 +03:00
parent 680791301f
commit 2240e2c39c
1 changed files with 2 additions and 1 deletions

View File

@ -210,7 +210,8 @@ protected override void Dispose(bool isDisposing)
if (fallbackSource != null)
fallbackSource.SourceChanged -= OnSourceChanged;
SkinSources.Clear();
foreach (var source in SkinSources.OfType<ISkinSource>())
source.SourceChanged -= OnSourceChanged;
}
private class NoFallbackProxy : ISkinSource