1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Handle unbinding better

This commit is contained in:
Dean Herbert 2019-01-31 19:08:54 +09:00
parent b69a19f810
commit 041e3bf823

View File

@ -58,8 +58,13 @@ namespace osu.Game.Overlays.Direct
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
beatmaps.BeatmapDownloadBegan -= attachDownload; beatmaps.BeatmapDownloadBegan -= attachDownload;
beatmaps.ItemAdded -= setAdded; beatmaps.ItemAdded -= setAdded;
State.UnbindAll();
attachDownload(null);
} }
#endregion #endregion
@ -103,7 +108,6 @@ namespace osu.Game.Overlays.Direct
private void onRequestSuccess(string data) private void onRequestSuccess(string data)
{ {
Schedule(() => State.Value = DownloadState.Downloaded); Schedule(() => State.Value = DownloadState.Downloaded);
attachDownload(null);
} }
private void onRequestProgress(float progress) private void onRequestProgress(float progress)
@ -113,7 +117,7 @@ namespace osu.Game.Overlays.Direct
private void onRequestFailure(Exception e) private void onRequestFailure(Exception e)
{ {
Schedule(() => State.Value = DownloadState.NotDownloaded); Schedule(() => attachDownload(null));
} }
private void setAdded(BeatmapSetInfo s, bool existing, bool silent) private void setAdded(BeatmapSetInfo s, bool existing, bool silent)