From 54013790fc9c4d86612c9bcce0609c76aeaada9d Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 4 Sep 2020 09:45:24 +0300 Subject: [PATCH 1/4] Fix MusicController raising TrackChanged event twice --- osu.Game/Overlays/MusicController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 17877a69a5..119aad5226 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -279,6 +279,10 @@ namespace osu.Game.Overlays private void changeBeatmap(WorkingBeatmap newWorking) { + // The provided beatmap is same as current, no need to do any changes. + if (newWorking == current) + return; + var lastWorking = current; TrackChangeDirection direction = TrackChangeDirection.None; From 65d541456ab8a408095c1b028930f72dfc72f902 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 4 Sep 2020 11:11:07 +0300 Subject: [PATCH 2/4] Slight rewording --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 119aad5226..74a438a124 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -279,7 +279,7 @@ namespace osu.Game.Overlays private void changeBeatmap(WorkingBeatmap newWorking) { - // The provided beatmap is same as current, no need to do any changes. + // If the provided beatmap is same as current, then there is no need to do any changes. if (newWorking == current) return; From 4236e5fe71ceec15ffd6881532d8fda26dbd8f38 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 4 Sep 2020 11:31:54 +0300 Subject: [PATCH 3/4] Replace useless "matching-code" comment with explanation of how it could happen Co-authored-by: Dean Herbert --- osu.Game/Overlays/MusicController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 74a438a124..edef4d8589 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -279,7 +279,8 @@ namespace osu.Game.Overlays private void changeBeatmap(WorkingBeatmap newWorking) { - // If the provided beatmap is same as current, then there is no need to do any changes. + // This method can potentially be triggered multiple times as it is eagerly fired in next() / prev() to ensure correct execution order + // (changeBeatmap must be called before consumers receive the bindable changed event, which is not the case when called from the bindable itself). if (newWorking == current) return; From 3239576a239922e8dad80f61bff40a1b42205618 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 4 Sep 2020 11:50:49 +0300 Subject: [PATCH 4/4] Minor rewording of new comment Co-authored-by: Dean Herbert --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index edef4d8589..31bd80d6f3 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -280,7 +280,7 @@ namespace osu.Game.Overlays private void changeBeatmap(WorkingBeatmap newWorking) { // This method can potentially be triggered multiple times as it is eagerly fired in next() / prev() to ensure correct execution order - // (changeBeatmap must be called before consumers receive the bindable changed event, which is not the case when called from the bindable itself). + // (changeBeatmap must be called before consumers receive the bindable changed event, which is not the case when the local beatmap bindable is updated directly). if (newWorking == current) return;