From 0ea6c65be6525c295902f3cd884c97d82bedb1d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Aug 2017 19:34:06 +0900 Subject: [PATCH] Fix potentially racey behaviour of versionManager initialisation Changing the state while the container wasn't necessarily completed loading caused inconsistent behaviour. --- osu.Desktop/OsuGameDesktop.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 88c8a206c8..a623347540 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -20,16 +20,11 @@ namespace osu.Desktop { internal class OsuGameDesktop : OsuGame { - private readonly VersionManager versionManager; + private VersionManager versionManager; public OsuGameDesktop(string[] args = null) : base(args) { - versionManager = new VersionManager - { - Depth = int.MinValue, - State = Visibility.Hidden - }; } public override Storage GetStorageForStableInstall() @@ -88,11 +83,15 @@ namespace osu.Desktop { base.LoadComplete(); - LoadComponentAsync(versionManager, Add); + LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }); + ScreenChanged += s => { - if (!versionManager.IsPresent && s is Intro) + if (s is Intro && s.ChildScreen == null) + { + Add(versionManager); versionManager.State = Visibility.Visible; + } }; }