From d69552fbcf1d2e5b29a6112d4bef78c5b6f61e3e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Dec 2021 13:21:10 +0900 Subject: [PATCH] Fix potential crash from cross-thread drawable mutation in collection management As seen at https://github.com/peppy/osu/runs/4613800663?check_suite_focus=true. --- osu.Game/Collections/DrawableCollectionListItem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Collections/DrawableCollectionListItem.cs b/osu.Game/Collections/DrawableCollectionListItem.cs index 988a3443c3..e2ec25337e 100644 --- a/osu.Game/Collections/DrawableCollectionListItem.cs +++ b/osu.Game/Collections/DrawableCollectionListItem.cs @@ -102,7 +102,6 @@ namespace osu.Game.Collections RelativeSizeAxes = Axes.Both, Size = Vector2.One, CornerRadius = item_height / 2, - Current = collection.Name, PlaceholderText = IsCreated.Value ? string.Empty : "Create a new collection" }, } @@ -114,6 +113,9 @@ namespace osu.Game.Collections { base.LoadComplete(); + // Bind late, as the collection name may change externally while still loading. + textBox.Current = collection.Name; + collectionName.BindValueChanged(_ => createNewCollection(), true); IsCreated.BindValueChanged(created => textBoxPaddingContainer.Padding = new MarginPadding { Right = created.NewValue ? button_width : 0 }, true); }