diff options
author | Eberhard Beilharz <eb1@sil.org> | 2014-12-09 20:15:12 +0300 |
---|---|---|
committer | Eberhard Beilharz <eb1@sil.org> | 2014-12-09 20:15:12 +0300 |
commit | c7ad829794ecdeb7001b6f0599cecdd0f9f581c0 (patch) | |
tree | c8f6217056a9c17b7e95ac42f6704bdbfcab4c76 /mcs/class/Managed.Windows.Forms | |
parent | bb4213224a7a14260132cf16fe81dfa80d7a2253 (diff) |
[MWF] Fix crash in multi-selection list view
Calling owner.UpdateMultiSelection can also change the selected item,
causing a crash.
This change improves the fix for Xamarin bug #23591.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs | 11 |
1 files changed, 6 insertions, 5 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 51e8b0d587e..1087563b16a 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -2669,13 +2669,14 @@ 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; } + // Side-effects of changing the selection can possibly result in ItemsMouseUp() being called and + // 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) { // Broken event - It's not fired from Item.Selected also ListViewVirtualItemsSelectionRangeChangedEventArgs args = |