Fix infinite loop when deleting columns from wxTreeListCtrl.
Wrong variable was checked in the loop adjusting the columns values resulting in an infinite loop. Closes #16955.
This commit is contained in:
@@ -170,10 +170,15 @@ public:
|
|||||||
|
|
||||||
wxScopedArray<wxString> oldTexts(m_columnsTexts);
|
wxScopedArray<wxString> oldTexts(m_columnsTexts);
|
||||||
m_columnsTexts = new wxString[numColumns - 2];
|
m_columnsTexts = new wxString[numColumns - 2];
|
||||||
|
|
||||||
|
// As above, n is the index in the new column texts array and m is the
|
||||||
|
// index in the old one.
|
||||||
for ( unsigned n = 1, m = 1; n < numColumns - 1; n++, m++ )
|
for ( unsigned n = 1, m = 1; n < numColumns - 1; n++, m++ )
|
||||||
{
|
{
|
||||||
if ( n == col )
|
if ( m == col )
|
||||||
{
|
{
|
||||||
|
// Skip copying the deleted column and keep the new index the
|
||||||
|
// same (so compensate for "n++" done in the loop).
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
else // Not the deleted column.
|
else // Not the deleted column.
|
||||||
|
Reference in New Issue
Block a user