fix bug lp:1319839

This commit is contained in:
Dick Hollenbeck 2014-05-21 01:06:52 -05:00
parent f31f92e45e
commit 2fa082f698
1 changed files with 9 additions and 4 deletions

View File

@ -166,7 +166,9 @@ public:
bool DeleteRows( size_t aPos, size_t aNumRows )
{
if( aPos + aNumRows <= rows.size() )
// aPos may be a large positive, e.g. size_t(-1), and the sum of
// aPos+aNumRows may wrap here, so both ends of the range are tested.
if( aPos < rows.size() && aPos + aNumRows <= rows.size() )
{
ROWS_ITER start = rows.begin() + aPos;
rows.erase( start, start + aNumRows );
@ -512,10 +514,13 @@ private:
int rowCount = m_cur_grid->GetNumberRows();
int curRow = getCursorRow();
m_cur_grid->DeleteRows( curRow );
if( curRow >= 0 )
{
m_cur_grid->DeleteRows( curRow );
if( curRow && curRow == rowCount - 1 )
m_cur_grid->SetGridCursor( curRow-1, getCursorCol() );
if( curRow && curRow == rowCount - 1 )
m_cur_grid->SetGridCursor( curRow-1, getCursorCol() );
}
}
void moveUpHandler( wxMouseEvent& event )