throw away the now invalid items in wxSelectionStore::SetItemCount() (bug 1929823) and added a unit test for this class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -214,3 +214,19 @@ void wxSelectionStore::OnItemDelete(unsigned item)
|
||||
}
|
||||
}
|
||||
|
||||
void wxSelectionStore::SetItemCount(unsigned count)
|
||||
{
|
||||
// forget about all items whose indices are now invalid if the size
|
||||
// decreased
|
||||
if ( count < m_count )
|
||||
{
|
||||
for ( size_t i = m_itemsSel.GetCount(); i > 0; i-- )
|
||||
{
|
||||
if ( m_itemsSel[i - 1] >= count )
|
||||
m_itemsSel.RemoveAt(i - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// remember the new number of items
|
||||
m_count = count;
|
||||
}
|
||||
|
Reference in New Issue
Block a user