From 5508f9f599c1a7d1c8279c4fcf328b9650a9dbc1 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 1 Aug 2016 22:22:50 +0200 Subject: [PATCH] Handle duplicate contents being returned and dummy them. Refs #310 * Unfortunately too late for v0.30, but at least this will help anyone who upgrades v0.29 -> v0.31 or such. --- .../3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs | 2 +- renderdocui/Windows/MainWindow.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs index 06780c296..6e661414b 100644 --- a/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs +++ b/renderdocui/3rdparty/WinFormsUI/Docking/DockPanel.Persistor.cs @@ -608,7 +608,7 @@ namespace WeifenLuo.WinFormsUI.Docking for (int i = 0; i < contents.Length; i++) { IDockContent content = deserializeContent(contents[i].PersistString); - if (content == null) + if (content == null || dockPanel.Contents.IndexOf(content) >= 0) content = new DummyContent(); content.DockHandler.DockPanel = dockPanel; content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion; diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index 8ba3b0061..73aba0689 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -519,6 +519,15 @@ namespace renderdocui.Windows // file is invalid return false; } + catch (Exception) + { + MessageBox.Show("Something went seriously wrong trying to load the window layout.\n" + + "Trying to recover now, but you might have to delete the layout file in %APPDATA%/renderdoc.\n", + "Error loading window layout", + MessageBoxButtons.OK, MessageBoxIcon.Error); + + return false; + } return true; }