Merge pull request #3570 from Flow-Launcher/exitting_null

Fix main window null when checking exiting
This commit is contained in:
Jack Ye 2025-05-22 18:43:23 +08:00 committed by GitHub
commit dc0454b014
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -32,7 +32,7 @@ namespace Flow.Launcher
#region Public Properties
public static IPublicAPI API { get; private set; }
public static bool Exiting => _mainWindow.CanClose;
public static bool LoadingOrExiting => _mainWindow == null || _mainWindow.CanClose;
#endregion

View file

@ -82,7 +82,7 @@ public partial class SettingWindow
_viewModel.PropertyChanged -= ViewModel_PropertyChanged;
// If app is exiting, settings save is not needed because main window closing event will handle this
if (App.Exiting) return;
if (App.LoadingOrExiting) return;
// Save settings when window is closed
_settings.Save();
App.API.SavePluginSettings();

View file

@ -1729,7 +1729,7 @@ namespace Flow.Launcher.ViewModel
public void Show()
{
// When application is exiting, we should not show the main window
if (App.Exiting) return;
if (App.LoadingOrExiting) return;
// When application is exiting, the Application.Current will be null
Application.Current?.Dispatcher.Invoke(() =>

View file

@ -96,7 +96,7 @@ namespace Flow.Launcher
private void Window_Closed(object sender, EventArgs e)
{
// If app is exiting, settings save is not needed because main window closing event will handle this
if (App.Exiting) return;
if (App.LoadingOrExiting) return;
// Save settings when window is closed
_settings.Save();
}