summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexttable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtexttable.cpp')
-rw-r--r--src/gui/text/qtexttable.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 48708c9..edba2c4 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -432,6 +432,13 @@ void QTextTablePrivate::fragmentRemoved(const QChar &type, uint fragment)
QTextFramePrivate::fragmentRemoved(type, fragment);
}
+/*!
+ /fn void QTextTablePrivate::update() const
+
+ This function is usually called when the table is "dirty".
+ It seems to update all kind of table information.
+
+*/
void QTextTablePrivate::update() const
{
Q_Q(const QTextTable);
@@ -439,7 +446,9 @@ void QTextTablePrivate::update() const
nRows = (cells.size() + nCols-1)/nCols;
// qDebug(">>>> QTextTablePrivate::update, nRows=%d, nCols=%d", nRows, nCols);
- grid = (int *)realloc(grid, nRows*nCols*sizeof(int));
+ int* newGrid = (int *)realloc(grid, nRows*nCols*sizeof(int));
+ Q_CHECK_PTR(newGrid);
+ grid = newGrid;
memset(grid, 0, nRows*nCols*sizeof(int));
QTextDocumentPrivate *p = pieceTable;
@@ -463,7 +472,9 @@ void QTextTablePrivate::update() const
cellIndices[i] = cell;
if (r + rowspan > nRows) {
- grid = (int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols);
+ newGrid = (int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols);
+ Q_CHECK_PTR(newGrid);
+ grid = newGrid;
memset(grid + (nRows*nCols), 0, sizeof(int)*(r+rowspan-nRows)*nCols);
nRows = r + rowspan;
}