Fix log should be disposed correctly

This commit is contained in:
teinarss
2021-04-14 19:10:49 +02:00
committed by Paul Chote
parent b23d533006
commit 5667081764
2 changed files with 18 additions and 11 deletions

View File

@@ -20,19 +20,22 @@ namespace OpenRA.Launcher
[STAThread]
static int Main(string[] args)
{
if (Debugger.IsAttached || args.Contains("--just-die"))
return (int)Game.InitializeAndRun(args);
AppDomain.CurrentDomain.UnhandledException += (_, e) => ExceptionHandler.HandleFatalError((Exception)e.ExceptionObject);
try
{
return (int)Game.InitializeAndRun(args);
}
catch (Exception e)
{
ExceptionHandler.HandleFatalError(e);
return (int)RunStatus.Error;
if (Debugger.IsAttached || args.Contains("--just-die"))
return (int)Game.InitializeAndRun(args);
AppDomain.CurrentDomain.UnhandledException += (_, e) => ExceptionHandler.HandleFatalError((Exception)e.ExceptionObject);
try
{
return (int)Game.InitializeAndRun(args);
}
catch (Exception e)
{
ExceptionHandler.HandleFatalError(e);
return (int)RunStatus.Error;
}
}
finally
{

View File

@@ -78,6 +78,10 @@ namespace OpenRA.WindowsLauncher
ExceptionHandler.HandleFatalError(e);
return (int)RunStatus.Error;
}
finally
{
Log.Dispose();
}
}
static int RunInnerLauncher(string[] args)