From: Julian Smart Date: Mon, 6 May 2013 08:54:48 +0000 (+0000) Subject: Applied patch #15183 (wxRichTextTable::DeleteColumns doesn't remove the deleted colum... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ef3f06797d8410b1dffe6244e2cc7597f5727adb?hp=789ab84044b35b6162c7110adfa54c91e182e909 Applied patch #15183 (wxRichTextTable::DeleteColumns doesn't remove the deleted columns: dghart) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index b68fbfde3c..22a123116f 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -10241,8 +10241,8 @@ bool wxRichTextTable::SetCellStyle(const wxRichTextSelection& selection, const w bool wxRichTextTable::DeleteRows(int startRow, int noRows) { - wxASSERT((startRow + noRows) < m_rowCount); - if ((startRow + noRows) >= m_rowCount) + wxASSERT((startRow + noRows) <= m_rowCount); + if ((startRow + noRows) > m_rowCount) return false; int i, j; @@ -10267,8 +10267,8 @@ bool wxRichTextTable::DeleteRows(int startRow, int noRows) bool wxRichTextTable::DeleteColumns(int startCol, int noCols) { - wxASSERT((startCol + noCols) < m_colCount); - if ((startCol + noCols) >= m_colCount) + wxASSERT((startCol + noCols) <= m_colCount); + if ((startCol + noCols) > m_colCount) return false; bool deleteRows = (noCols == m_colCount); @@ -10277,10 +10277,11 @@ bool wxRichTextTable::DeleteColumns(int startCol, int noCols) for (i = 0; i < m_rowCount; i++) { wxRichTextObjectPtrArray& colArray = m_cells[deleteRows ? 0 : i]; - for (j = startCol; j < (startCol+noCols); j++) + for (j = 0; j < noCols; j++) { - wxRichTextObject* cell = colArray[j]; + wxRichTextObject* cell = colArray[startCol]; RemoveChild(cell, true); + colArray.RemoveAt(startCol); } if (deleteRows)