Merge pull request #27021 from frenzibyte/fix-rooms-container-performance

Fix multiplayer/playlists lounge screen disposing rooms synchronously
This commit is contained in:
Bartłomiej Dach 2024-02-05 18:33:13 +01:00 committed by GitHub
commit 462a1c5186
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,7 +126,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
case NotifyCollectionChangedAction.Remove:
Debug.Assert(args.OldItems != null);
removeRooms(args.OldItems.Cast<Room>());
// clear operations have a separate path that benefits from async disposal,
// since disposing is quite expensive when performed on a high number of drawables synchronously.
if (args.OldItems.Count == roomFlow.Count)
clearRooms();
else
removeRooms(args.OldItems.Cast<Room>());
break;
}
}
@ -151,6 +157,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
}
}
private void clearRooms()
{
roomFlow.Clear();
// selection may have a lease due to being in a sub screen.
if (!SelectedRoom.Disabled)
SelectedRoom.Value = null;
}
private void updateSorting()
{
foreach (var room in roomFlow)