diff --git a/XenAdmin/Controls/MainWindowControls/NavigationView.cs b/XenAdmin/Controls/MainWindowControls/NavigationView.cs index ae7e2d49a..7ccfb258a 100644 --- a/XenAdmin/Controls/MainWindowControls/NavigationView.cs +++ b/XenAdmin/Controls/MainWindowControls/NavigationView.cs @@ -337,6 +337,9 @@ namespace XenAdmin.Controls.MainWindowControls private void RefreshTreeView() { + if (Disposing || IsDisposed || Program.Exiting) + return; + Program.Invoke(this, () => { if (ignoreRefreshTreeView > 0) diff --git a/XenAdmin/Program.cs b/XenAdmin/Program.cs index 6d4e15164..52abb02ea 100644 --- a/XenAdmin/Program.cs +++ b/XenAdmin/Program.cs @@ -596,8 +596,8 @@ namespace XenAdmin Messages.MESSAGEBOX_PROGRAM_UNEXPECTED_TITLE)); // CA-44733 - if (Program.MainWindow != null && !Program.MainWindow.InvokeRequired) - d.ShowDialog(Program.MainWindow); + if (MainWindow != null && !IsExiting(MainWindow) && !MainWindow.InvokeRequired) + d.ShowDialog(MainWindow); else d.ShowDialog(); }