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:
Anil
2018-07-10 11:31:54 +05:30
committed by Vadim Zeitlin
parent 7f1d08d5bd
commit 24820a5a67

View File

@@ -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();
}