1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:53:01 +08:00

Fix race condition causing selection to be reset incorrectly

This commit is contained in:
smoogipoo 2020-02-14 16:48:23 +09:00
parent d6768bba62
commit afd3e4604b

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -38,11 +37,11 @@ namespace osu.Game.Screens.Multi
((DrawableRoomPlaylistItem)newItem).Select(); ((DrawableRoomPlaylistItem)newItem).Select();
}, true); }, true);
Items.ItemsRemoved += items => Items.ItemsRemoved += items => Schedule(() =>
{ {
if (items.Any(i => i == SelectedItem.Value)) if (!Items.Contains(SelectedItem.Value))
SelectedItem.Value = null; SelectedItem.Value = null;
}; });
} }
protected override ScrollContainer<Drawable> CreateScrollContainer() => base.CreateScrollContainer().With(d => protected override ScrollContainer<Drawable> CreateScrollContainer() => base.CreateScrollContainer().With(d =>