From 988480437fbc89955ef4f08c283ce1f193972420 Mon Sep 17 00:00:00 2001 From: corvid Date: Sat, 11 Jun 2011 22:17:53 +0000 Subject: fix table leak with overlapping spans --- dw/table.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dw/table.cc b/dw/table.cc index 6708b3f0..8a46ce7c 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -320,11 +320,19 @@ void Table::addCell (Widget *widget, int colspan, int rowspan) for (int col = 0; col < colspanEff; col++) for (int row = 0; row < rowspan; row++) if (!(col == 0 && row == 0)) { + int i = (curRow + row) * numCols + curCol + col; + + child = children->get(i); + if (child) { + MSG("Overlapping spans in table.\n"); + assert(child->type == Child::SPAN_SPACE); + delete child; + } child = new Child (); child->type = Child::SPAN_SPACE; child->spanSpace.startCol = curCol; child->spanSpace.startRow = curRow; - children->set ((curRow + row) * numCols + curCol + col, child); + children->set (i, child); } // Set the "root" cell. -- cgit v1.2.3