Merge branch 'fix-skin-changed-disposal' into add-legacy-hit-animations

This commit is contained in:
Dean Herbert 2019-07-25 16:09:15 +09:00
commit 900d17a4db

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
@ -36,12 +36,15 @@ namespace osu.Game.Skinning
skin.SourceChanged += onChange; skin.SourceChanged += onChange;
} }
private void onChange() => SkinChanged(skin, allowDefaultFallback); private void onChange() =>
// schedule required to avoid calls after disposed.
// note that this has the side-effect of components only performance a skin change when they are alive.
Scheduler.AddOnce(() => SkinChanged(skin, allowDefaultFallback));
protected override void LoadAsyncComplete() protected override void LoadAsyncComplete()
{ {
base.LoadAsyncComplete(); base.LoadAsyncComplete();
onChange(); SkinChanged(skin, allowDefaultFallback);
} }
/// <summary> /// <summary>