Fix assert when adding columns to wxGrid using native header.
Change the order of updating m_colWidths array and the native header control in wxGird::Redimension() to ensure that we can test whether the column is shown (which results in accessing m_colWidths element at this column index) from the wxGridHeaderCtrl::SetColumnCount(). Closes #15225. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3d184f1e60
commit
a2d65663a0
@ -2945,8 +2945,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
|
||||
int numCols = msg.GetCommandInt();
|
||||
int oldNumCols = m_numCols;
|
||||
m_numCols += numCols;
|
||||
if ( m_useNativeHeader )
|
||||
GetGridColHeader()->SetColumnCount(m_numCols);
|
||||
|
||||
if ( !m_colAt.IsEmpty() )
|
||||
{
|
||||
@ -2978,6 +2976,12 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
|
||||
}
|
||||
}
|
||||
|
||||
// Notice that this must be called after updating m_colWidths above
|
||||
// as the native grid control will check whether the new columns
|
||||
// are shown which results in accessing m_colWidths array.
|
||||
if ( m_useNativeHeader )
|
||||
GetGridColHeader()->SetColumnCount(m_numCols);
|
||||
|
||||
if ( m_currentCellCoords == wxGridNoCellCoords )
|
||||
{
|
||||
// if we have just inserted cols into an empty grid the current
|
||||
|
Loading…
Reference in New Issue
Block a user