From cc07d05344852c6ae1a5f8683a4cb240bdc8777b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 22 Nov 2021 16:06:35 +0000 Subject: [PATCH] fix review issues. --- .../ClassicDesktopStyleApplicationLifetime.cs | 10 +++++++--- src/Avalonia.Input/FocusManager.cs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs b/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs index a13813056b..3a2fd68af5 100644 --- a/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs +++ b/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; @@ -122,15 +123,18 @@ namespace Avalonia.Controls.ApplicationLifetimes lifetimeEvents.ShutdownRequested += OnShutdownRequested; _cts = new CancellationTokenSource(); - ShowMainWindow(); // Note due to a bug in the JIT we wrap this in a method, otherwise MainWindow - // gets stuffed into a local var and can not be GCed until after the program stops. - // this method never exits until program end. + + // Note due to a bug in the JIT we wrap this in a method, otherwise MainWindow + // gets stuffed into a local var and can not be GCed until after the program stops. + // this method never exits until program end. + ShowMainWindow(); Dispatcher.UIThread.MainLoop(_cts.Token); Environment.ExitCode = _exitCode; return _exitCode; } + [MethodImpl(MethodImplOptions.NoInlining)] private void ShowMainWindow() { MainWindow?.Show(); diff --git a/src/Avalonia.Input/FocusManager.cs b/src/Avalonia.Input/FocusManager.cs index f21edd7591..2efd33df1d 100644 --- a/src/Avalonia.Input/FocusManager.cs +++ b/src/Avalonia.Input/FocusManager.cs @@ -145,7 +145,7 @@ namespace Avalonia.Input /// Notifies the focus manager of a change in focus scope. /// /// The new focus scope. - public void SetFocusScope(IFocusScope? scope) + public void SetFocusScope(IFocusScope scope) { scope = scope ?? throw new ArgumentNullException(nameof(scope));