From de7f8c4a3acb9c0906b0e7e4b474662ed0a745e9 Mon Sep 17 00:00:00 2001 From: Seraphima Zykova Date: Wed, 3 Mar 2021 14:03:37 +0300 Subject: [PATCH] [PT Settings] Crash on restart with OOBE window opened fix (#10005) --- src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs b/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs index 714035fb6c..7a4848da90 100644 --- a/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs +++ b/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs @@ -73,6 +73,7 @@ namespace PowerToys.Settings ShellPage.SetRestartAdminSndMessageCallback(msg => { Program.GetTwoWayIPCManager().Send(msg); + isOpen = false; System.Windows.Application.Current.Shutdown(); // close application }); @@ -117,7 +118,13 @@ namespace PowerToys.Settings // XAML Islands: If the window is open, explicitly force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384 if (isOpen) { - Show(); + try + { + Show(); + } + catch (InvalidOperationException) + { + } } }