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
             int numCols = msg.GetCommandInt();
             int oldNumCols = m_numCols;
             m_numCols += numCols;
-            if ( m_useNativeHeader )
-                GetGridColHeader()->SetColumnCount(m_numCols);
 
             if ( !m_colAt.IsEmpty() )
             {
                 }
             }
 
+            // 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