1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 19:32:55 +08:00

Clean up DrawableHitObject events on Dispose

This is just general safeties to avoid cases where
components don't correctly unbind events.
This commit is contained in:
Dean Herbert 2024-01-29 14:57:19 +09:00
parent 9c55498058
commit de32e7815b
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View File

@ -768,6 +768,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (CurrentSkin != null)
CurrentSkin.SourceChanged -= skinSourceChanged;
// Safeties against shooting in foot in cases where these are bound by external entities (like playfield) that don't clean up.
OnNestedDrawableCreated = null;
OnNewResult = null;
OnRevertResult = null;
DefaultsApplied = null;
HitObjectApplied = null;
}
public Bindable<double> AnimationStartTime { get; } = new BindableDouble();

View File

@ -38,6 +38,8 @@ namespace osu.Game.Rulesets.Objects
/// <summary>
/// Invoked after <see cref="ApplyDefaults"/> has completed on this <see cref="HitObject"/>.
/// </summary>
// TODO: This has no implicit unbind flow. Currently, if a Playfield manages HitObjects it will leave a bound event on this and cause the
// playfield to remain in memory.
public event Action<HitObject> DefaultsApplied;
public readonly Bindable<double> StartTimeBindable = new BindableDouble();