Don't iterate over selection twice needlessly in wxDataViewMainWindow::ItemDeleted().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2011-08-22 14:14:53 +00:00
parent b23de238c8
commit f6410588cf

View File

@ -2023,16 +2023,19 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
{
const int row = GetRowByItem(item);
int rowIndexInSelection = wxNOT_FOUND;
const size_t selCount = m_selection.size();
for ( size_t i = 0; i < selCount; i++ )
{
if ( m_selection[i] > (unsigned)row )
if ( m_selection[i] == (unsigned)row )
rowIndexInSelection = i;
else if ( m_selection[i] > (unsigned)row )
m_selection[i]--;
}
int itemRow = m_selection.Index(row);
if ( itemRow != wxNOT_FOUND )
m_selection.RemoveAt(itemRow);
if ( rowIndexInSelection != wxNOT_FOUND )
m_selection.RemoveAt(rowIndexInSelection);
}
}