1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Move binding to LoadComplete

Previously there was a chance that it would still never get disposed, as the event was bound in async load, before it was in a state it can be recursively disposed via the PlayerLoader call.
This commit is contained in:
Dean Herbert 2018-03-24 05:40:26 +09:00
parent 092ba4833e
commit 256baf6d60

View File

@ -55,14 +55,19 @@ namespace osu.Game.Skinning
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
fallbackSource = dependencies.Get<ISkinSource>(); fallbackSource = dependencies.Get<ISkinSource>();
if (fallbackSource != null)
fallbackSource.SourceChanged += onSourceChanged;
dependencies.CacheAs<ISkinSource>(this); dependencies.CacheAs<ISkinSource>(this);
return dependencies; return dependencies;
} }
protected override void LoadComplete()
{
base.LoadComplete();
if (fallbackSource != null)
fallbackSource.SourceChanged += onSourceChanged;
}
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);