Invalidate "hover" column index in wxHeaderCtrl if necessary
Don't leave "m_hover" invalid if the number of columns in wxHeaderCtrl is reduced, as this would result in a crash later when it is used. This notably fixes a crash after removing the last column from generic wxDataViewCtrl. Closes https://github.com/wxWidgets/wxWidgets/pull/852
This commit is contained in:
@@ -93,6 +93,11 @@ void wxHeaderCtrl::DoSetCount(unsigned int count)
|
||||
|
||||
m_numColumns = count;
|
||||
|
||||
// don't leave the column index invalid, this would cause a crash later if
|
||||
// it is used from OnMouse()
|
||||
if ( m_hover >= count )
|
||||
m_hover = COL_NONE;
|
||||
|
||||
InvalidateBestSize();
|
||||
Refresh();
|
||||
}
|
||||
|
Reference in New Issue
Block a user