From 3b174a71a3e73976ca591719ff37a5f3e1aac93c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 18:00:54 +0900 Subject: [PATCH 1/2] Move startup concurrency check to higher level Makes more sense to perform this check outside of the game itself now that we can. --- osu.Desktop/Program.cs | 5 ++++- osu.Game/OsuGame.cs | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index dc712f2593..7434dec010 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -74,7 +74,10 @@ namespace osu.Desktop // we want to allow multiple instances to be started when in debug. if (!DebugUtils.IsDebugBuild) - return 0; + { + Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); + Environment.Exit(0); + } } if (tournamentClient) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0e55a65aec..dde60158d1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -210,12 +210,6 @@ namespace osu.Game [BackgroundDependencyLoader] private void load() { - if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild) - { - Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); - Environment.Exit(0); - } - if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith('-')).ToArray(); From 5e53058fbc39415b3b72c61e028b3e1805094f1d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 18:03:43 +0900 Subject: [PATCH 2/2] Use same method of exiting execution as previously for safety --- osu.Desktop/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 7434dec010..8ccd23b418 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -76,7 +76,7 @@ namespace osu.Desktop if (!DebugUtils.IsDebugBuild) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); - Environment.Exit(0); + return 0; } }