diff options
author | Chris Hubbard <chris_hubbard@sil.org> | 2014-11-17 23:35:33 +0300 |
---|---|---|
committer | Chris Hubbard <chris_hubbard@sil.org> | 2014-11-17 23:35:33 +0300 |
commit | b47c95d90205de492faaa23d876005ce441cd3c8 (patch) | |
tree | 4e16d3651559d9ee1fc0fd766d81bdd8935de5a1 /mcs/class/Managed.Windows.Forms/System.Windows.Forms | |
parent | c12c27a9a98a356c7d7445ffb616fda7336c851a (diff) |
Fix crash when removing last item in ListView
When the VirtualListSize changes, the focus_item_index should
be reset (similar to how it currently resets the selected indices).
If the last item in a ListView has focus and it is removed by
an another action on the form (i.e. push a button to remove the
current item), then the focused_item_index is not updated when
the VirtualListSize changes, even though that item doesn't exist
anymore. When the ListView receives focus again, it tries to
invalidate the current focused item which causes an
ArgumentOutOfRangeException.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs | 1 |
1 files changed, 1 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..d46cfb22718 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -1031,6 +1031,7 @@ namespace System.Windows.Forms virtual_list_size = value; if (virtual_mode) { + focused_item_index = -1; selected_indices.Reset (); Redraw (true); } |