]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed bug that caused wxHtmlWindow to segfault on html tables with cell(s) with rowsp...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 23 Nov 1999 20:09:18 +0000 (20:09 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 23 Nov 1999 20:09:18 +0000 (20:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/m_tables.cpp

index af88b562d977b7b6079c4670c5e063cda646f658..33e24919fb2c4a7fa39838478edb4148e35366fb 100644 (file)
@@ -169,19 +169,21 @@ void wxHtmlTableCell::ReallocCols(int cols)
 void wxHtmlTableCell::ReallocRows(int rows)
 {
     m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows);
-    if (m_NumCols != 0) {
-        int x = rows - 1;
-        m_CellInfo[x] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols);
-        for (int i = 0; i < m_NumCols; i++)
-            m_CellInfo[x][i].flag = cellFree;
+    for (int row = m_NumRows; row < rows ; row++) 
+    {
+        if (m_NumCols == 0) 
+            m_CellInfo[row] = NULL;
+        else 
+        {
+            m_CellInfo[row] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols);
+            for (int col = 0; col < m_NumCols; col++)
+                m_CellInfo[row][col].flag = cellFree;
+        }
     }
-    else
-        m_CellInfo[rows - 1] = NULL;
     m_NumRows = rows;
 }
 
 
-
 void wxHtmlTableCell::AddRow(const wxHtmlTag& tag)
 {
     if (m_ActualRow + 1 > m_NumRows - 1)