diff options
author | Lluis Sanchez Gual <lluis@novell.com> | 2010-10-25 13:36:55 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@novell.com> | 2010-10-25 13:36:55 +0400 |
commit | 8294059b329a758b13e7dafa22062fbdb25c86ab (patch) | |
tree | 049f527d446626c75dd02b6f9d425f1c0878565b /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs | |
parent | e657eea579481dceae159cfe79f66a6cb405073b (diff) |
Fix bug 646284 - MD crashes on opening Default Policies
The problem was that MD was trying to display a page that was
already removed because it had no panels and no children.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs index 952e27561c..e4c1416e96 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs @@ -226,8 +226,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs // Remove the section if it doesn't have children nor panels SectionPage page = CreatePage (it, section, dataObject); TreeIter cit; - if (removeEmptySections && page.Panels.Count == 0 && !store.IterChildren (out cit, it)) + if (removeEmptySections && page.Panels.Count == 0 && !store.IterChildren (out cit, it)) { store.Remove (ref it); + return TreeIter.Zero; + } return it; } @@ -295,6 +297,22 @@ namespace MonoDevelop.Ide.Gui.Dialogs } } + bool HasVisiblePanel (OptionsDialogSection section) + { + SectionPage page; + if (!pages.TryGetValue (section, out page)) + return false; + if (page.Panels.Count > 0) + return true; + foreach (ExtensionNode node in section.ChildNodes) { + if (node is OptionsDialogSection) { + if (HasVisiblePanel ((OptionsDialogSection) node)) + return true; + } + } + return false; + } + public void ShowPage (OptionsDialogSection section) { SectionPage page; @@ -304,8 +322,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (page.Panels.Count == 0) { foreach (ExtensionNode node in section.ChildNodes) { if (node is OptionsDialogSection) { - ShowPage ((OptionsDialogSection) node); - return; + if (HasVisiblePanel ((OptionsDialogSection) node)) { + ShowPage ((OptionsDialogSection) node); + return; + } } } } |