Fix compose blueprint container not unsubscribing from event

Closes https://github.com/ppy/osu/issues/28938.

This is related to reloading the composer on timing point changes in
scrolling rulesets. The lack of unsubscription from this would cause
blueprints to be created for disposed composers via the
`hitObjectAdded()` flow.

The following line looks as if a sync load should be forced on a newly
created placement blueprint:

    da4d37c4ad/osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs (L364)

however, it is not the case if the parent
(`placementBlueprintContainer`) is disposed, which it would be in this
case. Therefore, the blueprint stays `NotLoaded` rather than `Ready`,
therefore it never receives its DI dependencies, therefore it dies on
an `EditorBeatmap` nullref.
This commit is contained in:
Bartłomiej Dach 2024-07-19 08:26:53 +02:00
parent 124bc9c43b
commit 4dd225fdc8
No known key found for this signature in database

View File

@ -9,6 +9,7 @@ using Humanizer;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -405,5 +406,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
CommitIfPlacementActive();
}
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (Beatmap.IsNotNull())
Beatmap.HitObjectAdded -= hitObjectAdded;
}
}
}