From f021fb3ee9c6abd16ff631d209af9d7e2db6b9bf Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 26 Dec 2006 16:47:43 +0000 Subject: [PATCH] SD2-1254 - EditHighlighting dialog throws an object disposed exception if the dialog is closed without clicking the Cancel or OK button. The option panel's controls are now cleared when the EditHighlighting dialog is disposed. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2213 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/EditHighlightingDialog.cs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs index 9535eecc26..bbffada116 100644 --- a/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs +++ b/src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs @@ -13,8 +13,8 @@ using System.Windows.Forms; using ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes; using ICSharpCode.SharpDevelop.Gui.XmlForms; -namespace ICSharpCode.SharpDevelop.Gui { - +namespace ICSharpCode.SharpDevelop.Gui +{ public class EditHighlightingDialog : BaseSharpDevelopForm { private System.Windows.Forms.Button acceptBtn; @@ -61,6 +61,15 @@ namespace ICSharpCode.SharpDevelop.Gui { nodeTree.SelectedNode = topNode; } + protected override void Dispose(bool disposing) + { + if (disposing) { + nodeTree.Nodes.Clear(); + optionPanel.Controls.Clear(); + } + base.Dispose(disposing); + } + void cancelClick(object sender, EventArgs e) { if (currentPanel != null) { @@ -68,9 +77,7 @@ namespace ICSharpCode.SharpDevelop.Gui { optionPanel.Controls.Clear(); } nodeTree.Nodes.Clear(); - DialogResult = DialogResult.Cancel; - } void acceptClick(object sender, EventArgs e) @@ -81,12 +88,9 @@ namespace ICSharpCode.SharpDevelop.Gui { } currentPanel.StoreSettings(); currentPanel.ParentNode.UpdateNodeText(); - optionPanel.Controls.Clear(); } - nodeTree.Nodes.Clear(); - DialogResult = DialogResult.OK; } @@ -102,7 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui { new Rectangle(0, 0, Width, Height)); } - public GradientLabel() : base() + public GradientLabel() { UseMnemonic = false; } @@ -110,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Gui { private NodeOptionPanel currentPanel; - void NodeTreeBeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) + void NodeTreeBeforeSelect(object sender, TreeViewCancelEventArgs e) { if (currentPanel != null) { if (!currentPanel.ValidateSettings()) { @@ -120,7 +124,7 @@ namespace ICSharpCode.SharpDevelop.Gui { } } - void NodeTreeAfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) + void NodeTreeAfterSelect(object sender, TreeViewEventArgs e) { if (currentPanel != null) { currentPanel.StoreSettings(); @@ -136,9 +140,6 @@ namespace ICSharpCode.SharpDevelop.Gui { } gradientLabel.Text = " " + e.Node.Text; - } - } - }