Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on right click on a taiko hit object #30324

Closed
namooTH opened this issue Oct 17, 2024 · 2 comments · Fixed by #30377
Closed

Error on right click on a taiko hit object #30324

namooTH opened this issue Oct 17, 2024 · 2 comments · Fixed by #30377

Comments

@namooTH
Copy link

namooTH commented Oct 17, 2024

Type

Game behaviour

Bug description

In the Taiko editor, when placing 2 objects, after right-clicking the first placed object, the game would error.

Screenshots or videos

vlc-record-2024-10-17-22h14m34s-2024-10-17.22-03-42.mp4-.mp4

Version

2024.1009.1-lazer

Logs

compressed-logs.zip

@bdach bdach self-assigned this Oct 18, 2024
@bdach
Copy link
Collaborator

bdach commented Oct 18, 2024

Exception is

2024-10-17 15:15:45 [error]: An unhandled error has occurred.
2024-10-17 15:15:45 [error]: System.InvalidOperationException: Can not change depth of drawable which is not contained within this CompositeDrawable.
2024-10-17 15:15:45 [error]: at osu.Framework.Graphics.Containers.CompositeDrawable.ChangeInternalChildDepth(Drawable child, Single newDepth)
2024-10-17 15:15:45 [error]: at osu.Framework.Graphics.Containers.Container`1.ChangeChildDepth(T child, Single newDepth)
2024-10-17 15:15:45 [error]: at osu.Framework.Graphics.Containers.Container`1.ChangeChildDepth(T child, Single newDepth)
2024-10-17 15:15:45 [error]: at osu.Game.Screens.Edit.Compose.Components.BlueprintContainer`1.OnBlueprintSelected(SelectionBlueprint`1 blueprint)
2024-10-17 15:15:45 [error]: at osu.Game.Screens.Edit.Compose.Components.EditorBlueprintContainer.OnBlueprintSelected(SelectionBlueprint`1 blueprint)
2024-10-17 15:15:45 [error]: at osu.Game.Rulesets.Edit.SelectionBlueprint`1.updateState()
2024-10-17 15:15:45 [error]: at osu.Game.Rulesets.Edit.SelectionBlueprint`1.set_State(SelectionState value)
2024-10-17 15:15:45 [error]: at osu.Game.Rulesets.Edit.SelectionBlueprint`1.Select()

which suggests Yet Another Custom Comparer Fail. Previously: #13473 (comment).

Notably this is the timeline causing the crash, not the composer. This is likely related to the timeline jamming the current placement object into itself and hitting comparer issues because the current placement object is very mutable and breaks the sorted order. That said, I tried a few things, which didn't work, after which I tried forcibly sorting the list before taking the index, which also didn't work, which is quite worrying.

diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
index 30c1258f93..ee1231c820 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
@@ -32,7 +32,12 @@ public abstract partial class BlueprintContainer<T> : CompositeDrawable, IKeyBin
     {
         protected DragBox DragBox { get; private set; }
 
-        public Container<SelectionBlueprint<T>> SelectionBlueprints { get; private set; }
+        public SelectionBlueprintContainer SelectionBlueprints { get; private set; }
+
+        public partial class SelectionBlueprintContainer : Container<SelectionBlueprint<T>>
+        {
+            internal void Sort() => SortInternal();
+        }
 
         public SelectionHandler<T> SelectionHandler { get; private set; }
 
@@ -95,7 +100,7 @@ private void load()
             });
         }
 
-        protected virtual Container<SelectionBlueprint<T>> CreateSelectionBlueprintContainer() => new Container<SelectionBlueprint<T>> { RelativeSizeAxes = Axes.Both };
+        protected virtual SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
 
         /// <summary>
         /// Creates a <see cref="Components.SelectionHandler{T}"/> which outlines items and handles movement of selections.
@@ -513,6 +518,7 @@ protected virtual void UpdateSelectionFromDragBox(HashSet<T> selectionBeforeDrag
         protected virtual void OnBlueprintSelected(SelectionBlueprint<T> blueprint)
         {
             SelectionHandler.HandleSelected(blueprint);
+            SelectionBlueprints.Sort();
             SelectionBlueprints.ChangeChildDepth(blueprint, 1);
         }
 
diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs
index 378d378be3..7b046251e0 100644
--- a/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/EditorBlueprintContainer.cs
@@ -9,7 +9,6 @@
 using System.Linq;
 using osu.Framework.Allocation;
 using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
 using osu.Framework.Input;
 using osu.Framework.Input.Events;
 using osu.Game.Rulesets.Edit;
@@ -136,7 +135,7 @@ protected override bool OnDoubleClick(DoubleClickEvent e)
             base.ApplySelectionOrder(blueprints)
                 .OrderBy(b => Math.Min(Math.Abs(EditorClock.CurrentTime - b.Item.GetEndTime()), Math.Abs(EditorClock.CurrentTime - b.Item.StartTime)));
 
-        protected override Container<SelectionBlueprint<HitObject>> CreateSelectionBlueprintContainer() => new HitObjectOrderedSelectionContainer { RelativeSizeAxes = Axes.Both };
+        protected override SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new HitObjectOrderedSelectionContainer { RelativeSizeAxes = Axes.Both };
 
         protected override SelectionHandler<HitObject> CreateSelectionHandler() => new EditorSelectionHandler();
 
diff --git a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs
index 8f54d55d5d..49106436b2 100644
--- a/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/HitObjectOrderedSelectionContainer.cs
@@ -4,7 +4,6 @@
 using osu.Framework.Allocation;
 using osu.Framework.Extensions.ObjectExtensions;
 using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
 using osu.Game.Rulesets.Edit;
 using osu.Game.Rulesets.Objects;
 using osu.Game.Rulesets.Objects.Types;
@@ -14,7 +13,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
     /// <summary>
     /// A container for <see cref="SelectionBlueprint{HitObject}"/> ordered by their <see cref="HitObject"/> start times.
     /// </summary>
-    public sealed partial class HitObjectOrderedSelectionContainer : Container<SelectionBlueprint<HitObject>>
+    public sealed partial class HitObjectOrderedSelectionContainer : BlueprintContainer<HitObject>.SelectionBlueprintContainer
     {
         [Resolved]
         private EditorBeatmap editorBeatmap { get; set; } = null!;
diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
index a6af83d268..c63219569d 100644
--- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
@@ -91,7 +91,7 @@ private void placementChanged(ValueChangedEvent<HitObject> obj)
             }
         }
 
-        protected override Container<SelectionBlueprint<HitObject>> CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
+        protected override SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
 
         protected override bool OnDragStart(DragStartEvent e)
         {
@@ -287,7 +287,7 @@ protected override void OnHoverLost(HoverLostEvent e)
             }
         }
 
-        protected partial class TimelineSelectionBlueprintContainer : Container<SelectionBlueprint<HitObject>>
+        protected partial class TimelineSelectionBlueprintContainer : SelectionBlueprintContainer
         {
             protected override Container<SelectionBlueprint<HitObject>> Content { get; }
 

@ppy-sentryintegration
Copy link

Sentry issue: OSU-11TG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants