Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2015-01-03 17:42:22 +0300
committerMiguel de Icaza <miguel@gnome.org>2015-01-03 17:42:32 +0300
commita080a7d8a9f9942549cbaabd37f35282cabbb856 (patch)
treeadc029ffce38f13cbab6c105759cc030633f6ba7 /mcs/class/Managed.Windows.Forms
parent43aa9be05dc72ee531229060a98f82cd7d1790eb (diff)
[Windows.Forms] DataGridViewTextBoxCell: do not use a shared editing control
This fixes the case of the System.ObjectDisposedException being thrown when editing a text cell in a DataGridView control a second time. The problem is that the static control would be disposed by the code in DataGridView's EditingControlInternal, but this instance was reused over and over. Instead, we now createa new editing control every time that the TextBoxCell is created. The investigation for this bug took place here: https://bugzilla.xamarin.com/show_bug.cgi?id=9653 Fixes also: https://bugzilla.xamarin.com/show_bug.cgi?id=22297
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs19
1 files changed, 10 insertions, 9 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
index ef0b80287d0..9724a269c74 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
@@ -33,13 +33,16 @@ namespace System.Windows.Forms {
public class DataGridViewTextBoxCell : DataGridViewCell {
private int maxInputLength = 32767;
- private static DataGridViewTextBoxEditingControl editingControl;
+ private DataGridViewTextBoxEditingControl editingControl;
- static DataGridViewTextBoxCell ()
+ void CreateEditingControl ()
{
- editingControl = new DataGridViewTextBoxEditingControl();
- editingControl.Multiline = false;
- editingControl.BorderStyle = BorderStyle.None;
+ editingControl = new DataGridViewTextBoxEditingControl() {
+ EditingControlDataGridView = DataGridView,
+ Multiline = false,
+ BorderStyle = BorderStyle.None,
+ MaxLength = maxInputLength
+ };
}
public DataGridViewTextBoxCell ()
@@ -88,12 +91,10 @@ namespace System.Windows.Forms {
if (DataGridView == null) {
throw new InvalidOperationException("There is no associated DataGridView.");
}
-
+
+ CreateEditingControl ();
DataGridView.EditingControlInternal = editingControl;
- editingControl.EditingControlDataGridView = DataGridView;
- editingControl.MaxLength = maxInputLength;
-
if (initialFormattedValue == null || initialFormattedValue.ToString () == string.Empty)
editingControl.Text = string.Empty;
else