diff options
author | Stephen McConnel <stephen_mcconnel@sil.org> | 2014-10-03 22:09:10 +0400 |
---|---|---|
committer | Stephen McConnel <stephen_mcconnel@sil.org> | 2014-10-03 22:09:10 +0400 |
commit | 82093256f483cdd1ac01c20f1cb9058d3c5036af (patch) | |
tree | 38e21fdf1e83afbed089dbab4e44f480991f85e4 /mcs/class/Managed.Windows.Forms/System.Windows.Forms | |
parent | b0cff959e47c3d9955e6675364bf71404cd74bac (diff) |
Fix potential crash in ListView.ItemControl.ItemsMouseDown
This fixes Xamarin bug 23591. Side-effects of internal processing of
ItemsMouseDown can cause ItemsMouseUp before ItemsMouseUp has finished.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs index 3af4684710a..73d7a837d2b 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -2668,6 +2668,11 @@ namespace System.Windows.Forms owner.UpdateMultiSelection (clicked_item.DisplayIndex, reselect); } else { clicked_item.Selected = true; + // Side-effects to setting Selected can possibly result in ItemsMouseUp() being called + // and clicked_item being set to null. (See Xamarin bug 23591.) In such a case, assume + // that there's nothing more we can do here. + if (clicked_item == null) + return; } if (owner.VirtualMode && changed) { |