2
2
using CommunityToolkit . WinUI ;
3
3
using CommunityToolkit . WinUI . Helpers ;
4
4
using CommunityToolkit . WinUI . Notifications ;
5
- using Files . App . Controllers ;
6
5
using Files . App . DataModels ;
7
6
using Files . App . Extensions ;
8
7
using Files . App . Filesystem ;
30
29
using Microsoft . Extensions . DependencyInjection ;
31
30
using Microsoft . UI . Windowing ;
32
31
using Microsoft . UI . Xaml ;
32
+ using Microsoft . UI . Xaml . Controls ;
33
33
using Microsoft . Windows . AppLifecycle ;
34
34
using System ;
35
35
using System . Diagnostics ;
@@ -54,6 +54,7 @@ public partial class App : Application
54
54
private static bool ShowErrorNotification = false ;
55
55
56
56
public static string OutputPath { get ; set ; }
57
+ public static CommandBarFlyout ? LastOpenedFlyout { get ; set ; }
57
58
public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper ( ) ;
58
59
public static SettingsViewModel AppSettings { get ; private set ; }
59
60
public static AppModel AppModel { get ; private set ; }
@@ -287,6 +288,15 @@ private async void Window_Closed(object sender, WindowEventArgs args)
287
288
{
288
289
// Save application state and stop any background activity
289
290
291
+ // A Workaround for the crash (#10110)
292
+ if ( LastOpenedFlyout ? . IsOpen ?? false )
293
+ {
294
+ args . Handled = true ;
295
+ LastOpenedFlyout . Closed += ( sender , e ) => App . Current . Exit ( ) ;
296
+ LastOpenedFlyout . Hide ( ) ;
297
+ return ;
298
+ }
299
+
290
300
await Task . Yield ( ) ; // Method can take a long time, make sure the window is hidden
291
301
292
302
SaveSessionTabs ( ) ;
0 commit comments