Closed diwo closed 4 years ago
Old implementation accesses out of range iterator which sometimes results in a crash.
For example this can happen in the following when m_entriesShown is larger than the size of m_items:
m_entriesShown
m_items
oldFocus == (this->m_items.begin() + this->m_offset + this->m_entriesShown - 2)->element
This fix changes all comparisons to be made against indexes instead. The number of "lead" spaces between top/bottom item and focused item has also been parameterized for clarity. The lead is reduced to 0 when m_entriesShown is 2 or less.
Old implementation accesses out of range iterator which sometimes results in a crash.
For example this can happen in the following when
m_entriesShown
is larger than the size ofm_items
:This fix changes all comparisons to be made against indexes instead. The number of "lead" spaces between top/bottom item and focused item has also been parameterized for clarity. The lead is reduced to 0 when
m_entriesShown
is 2 or less.