From fd48249eef42c8af74fb50373744d58bc80eb3f7 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 13 Sep 2022 02:20:52 +0200 Subject: [PATCH] fix with new event --- .../Components/HitObjectOrderedSelectionContainer.cs | 6 ++---- osu.Game/Screens/Edit/EditorBeatmap.cs | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs index d6fd07c998..2d8dca9c2d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs @@ -24,11 +24,9 @@ namespace osu.Game.Screens.Edit.Compose.Components { base.LoadComplete(); - editorBeatmap.HitObjectUpdated += hitObjectUpdated; + editorBeatmap.SelectionBlueprintsShouldBeSorted += SortInternal; } - private void hitObjectUpdated(HitObject _) => SortInternal(); - public override void Add(SelectionBlueprint drawable) { SortInternal(); @@ -72,7 +70,7 @@ namespace osu.Game.Screens.Edit.Compose.Components base.Dispose(isDisposing); if (editorBeatmap != null) - editorBeatmap.HitObjectUpdated -= hitObjectUpdated; + editorBeatmap.SelectionBlueprintsShouldBeSorted -= SortInternal; } } } diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index 8aa754b305..82f2187901 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -48,6 +48,11 @@ namespace osu.Game.Screens.Edit /// public event Action HitObjectUpdated; + /// + /// Invoked after is updated during and blueprints need to be sorted immediately to prevent a crash. + /// + public event Action SelectionBlueprintsShouldBeSorted; + /// /// All currently selected s. /// @@ -331,6 +336,9 @@ namespace osu.Game.Screens.Edit beatmapProcessor?.PostProcess(); + // Signal selection blueprint sorting because it is possible that the beatmap processor changed the order of the selection blueprints + SelectionBlueprintsShouldBeSorted?.Invoke(); + // callbacks may modify the lists so let's be safe about it var deletes = batchPendingDeletes.ToArray(); batchPendingDeletes.Clear();