From d32fb5f9f47e5224fc765daa369cf34df4a7d506 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Tue, 19 Jul 2011 22:35:48 +0000 Subject: [PATCH] Fix deleting columns in wxGridStringTable with custom column labels. We erroneously removed too many elements from m_colLabels array (basically we always removed all the elements remaining after this column, irrespectively of the actual number of columns to delete), fix this by removing at most the specified number of columns -- or possibly less if the array isn't entirely filled. See #13329. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 423cfe8bb8..8326934f7f 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1534,9 +1534,8 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) // m_colLabels stores just as many elements as it needs, e.g. if only // the label of the first column had been set it would have only one // element and not numCols, so account for it - int nToRm = m_colLabels.size() - colID; - if ( nToRm > 0 ) - m_colLabels.RemoveAt( colID, nToRm ); + int numRemaining = m_colLabels.size() - colID; + m_colLabels.RemoveAt( colID, wxMin(numCols, numRemaining) ); } if ( numCols >= curNumCols ) -- 2.47.2