1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

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.
This commit is contained in:
Dean Herbert 2021-12-23 13:21:10 +09:00
parent e1b539fa9e
commit d69552fbcf

View File

@ -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);
}