Fix refreshing wxGenericListCtrl with multiple selection

Changing the selection could behave wrongly and result in an assert
failure as the selection anchor could have become invalid, due to the
change of the number of items in the control.

Fix this by invalidating it when this happens.
This commit is contained in:
Vadim Zeitlin 2023-10-17 02:05:12 +02:00
parent 99febcf9c1
commit 5885eea5ea

View file

@ -3730,6 +3730,10 @@ void wxListMainWindow::SetItemCount(long count)
if ( HasCurrent() && m_current >= (size_t)count )
ChangeCurrent(count - 1);
// And do the same thing for the multiple selection anchor.
if ( m_anchor != (size_t)-1 && m_anchor >= (size_t)count )
m_anchor = count - 1;
m_selStore.SetItemCount(count);
m_countVirt = count;