From 645d83707a222cb90b410768ca7e5e4023a85ecb Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:06:00 -0500 Subject: [PATCH] Fix: Fixed issue were old tabs briefly displayed when startup was set to 'open new tab' (#16596) --- src/Files.App/App.xaml.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Files.App/App.xaml.cs b/src/Files.App/App.xaml.cs index 8e77a1fd51d4..8a64719ac069 100644 --- a/src/Files.App/App.xaml.cs +++ b/src/Files.App/App.xaml.cs @@ -198,6 +198,7 @@ private async void Window_Closed(object sender, WindowEventArgs args) // Save application state and stop any background activity IUserSettingsService userSettingsService = Ioc.Default.GetRequiredService(); StatusCenterViewModel statusCenterViewModel = Ioc.Default.GetRequiredService(); + ICommandManager commandManager = Ioc.Default.GetRequiredService(); // A Workaround for the crash (#10110) if (_LastOpenedFlyout?.IsOpen ?? false) @@ -209,7 +210,10 @@ private async void Window_Closed(object sender, WindowEventArgs args) } // Save the current tab list in case it was overwriten by another instance - AppLifecycleHelper.SaveSessionTabs(); + if (userSettingsService.GeneralSettingsService.ContinueLastSessionOnStartUp || userSettingsService.AppSettingsService.RestoreTabsOnStartup) + AppLifecycleHelper.SaveSessionTabs(); + else + await commandManager.CloseAllTabs.ExecuteAsync(); if (OutputPath is not null) {