1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Fix crashes when importing/deleting from model managers

This commit is contained in:
smoogipoo 2018-11-20 18:09:23 +09:00 committed by miterosan
parent aac7081580
commit cd2737156f
5 changed files with 14 additions and 14 deletions

View File

@ -78,17 +78,17 @@ namespace osu.Game.Beatmaps.Drawables
}
}
private void setAdded(BeatmapSetInfo s)
private void setAdded(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
DownloadState.Value = DownloadStatus.Downloaded;
}
});
private void setRemoved(BeatmapSetInfo s)
private void setRemoved(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
DownloadState.Value = DownloadStatus.NotDownloaded;
}
});
private void downloadBegan(DownloadBeatmapSetRequest d)
{

View File

@ -174,11 +174,11 @@ namespace osu.Game.Overlays.Direct
};
}
private void setAdded(BeatmapSetInfo s)
private void setAdded(BeatmapSetInfo s) => Schedule(() =>
{
if (s.OnlineBeatmapSetID == SetInfo.OnlineBeatmapSetID)
progressBar.FadeOut(500);
}
});
protected override void LoadComplete()
{

View File

@ -83,20 +83,20 @@ namespace osu.Game.Overlays.Music
beatmapBacking.ValueChanged += _ => updateSelectedSet();
}
private void addBeatmapSet(BeatmapSetInfo obj)
private void addBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
{
var newItem = new PlaylistItem(obj) { OnSelect = set => Selected?.Invoke(set) };
items.Add(newItem);
items.SetLayoutPosition(newItem, items.Count - 1);
}
});
private void removeBeatmapSet(BeatmapSetInfo obj)
private void removeBeatmapSet(BeatmapSetInfo obj) => Schedule(() =>
{
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == obj.ID);
if (itemToRemove != null)
items.Remove(itemToRemove);
}
});
private void updateSelectedSet()
{

View File

@ -214,8 +214,8 @@ namespace osu.Game.Overlays
beatmapSets.Insert(index, beatmapSetInfo);
}
private void handleBeatmapAdded(BeatmapSetInfo obj) => beatmapSets.Add(obj);
private void handleBeatmapRemoved(BeatmapSetInfo obj) => beatmapSets.RemoveAll(s => s.ID == obj.ID);
private void handleBeatmapAdded(BeatmapSetInfo obj) => Schedule(() => beatmapSets.Add(obj));
private void handleBeatmapRemoved(BeatmapSetInfo obj) => Schedule(() => beatmapSets.RemoveAll(s => s.ID == obj.ID));
protected override void LoadComplete()
{

View File

@ -70,8 +70,8 @@ namespace osu.Game.Overlays.Settings.Sections
dropdownBindable.BindValueChanged(v => configBindable.Value = v.ID);
}
private void itemRemoved(SkinInfo s) => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray();
private void itemAdded(SkinInfo s) => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray();
private void itemRemoved(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray());
private void itemAdded(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray());
protected override void Dispose(bool isDisposing)
{