mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Fix crashes when importing/deleting from model managers
This commit is contained in:
parent
51c192d4b7
commit
5ad96afea0
@ -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)
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user