From 927da98a2a4860f926968b4704e02d58d7cf0eea Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Mar 2013 22:57:56 -0400 Subject: Add integrity check after column cell storage is modified. Change-Id: I8d2bd7616e0428e4e881ef0dc1012c4973e636a9 --- sc/inc/column.hxx | 8 ++++++++ sc/source/core/data/column2.cxx | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index ca68e7fd55c0..666d067b0b20 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -28,6 +28,14 @@ #include #include +#define DEBUG_COLUMN_STORAGE 1 + +#if DEBUG_COLUMN_STORAGE +#ifdef NDEBUG +#undef NDEBUG +#endif +#endif + #include #include diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 9190b313b7dd..19e5e9cab211 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -56,6 +56,13 @@ #include +#if DEBUG_COLUMN_STORAGE +#include "columniterator.hxx" +#include +using std::cout; +using std::endl; +#endif + // ----------------------------------------------------------------------- // factor from font size to optimal cell height (text width) @@ -1384,6 +1391,20 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const void ScColumn::CellStorageModified() { +#if DEBUG_COLUMN_STORAGE + ScColumnTextWidthIterator aIter(*this, 0, MAXROW); + for (; aIter.hasCell(); aIter.next()) + { + SCROW nRow = aIter.getPos(); + ScBaseCell* pCell = GetCell(nRow); + if (!pCell) + { + cout << "Cell and text width storages are out of sync!" << endl; + cout.flush(); + abort(); + } + } +#endif } unsigned short ScColumn::GetTextWidth(SCROW nRow) const -- cgit