Revision: 7293
Author:   nogu.dev
Date:     Sat Sep 10 18:52:14 2011
Log:      * qt4/pref/customwidgets.cpp
  - (TableEditForm::setCustomTable): Set m_customTable to custom_table.
  - (TableEditForm::customTable): Free custom_table to avoid leak.
* qt4/pref/customwidgets.h
  - (TableEditForm): Add TableEditForm::m_customTable.
http://code.google.com/p/uim/source/detail?r=7293

Modified:
 /trunk/qt4/pref/customwidgets.cpp
 /trunk/qt4/pref/customwidgets.h

=======================================
--- /trunk/qt4/pref/customwidgets.cpp   Sat Sep 10 18:09:56 2011
+++ /trunk/qt4/pref/customwidgets.cpp   Sat Sep 10 18:52:14 2011
@@ -1349,13 +1349,21 @@
             m_table->setItem( row, column, item );
         }
     }
+    m_customTable = custom_table;
 }

 char ***TableEditForm::customTable() const
 {
+    char ***custom_table = m_customTable;
+    for ( int row = 0; custom_table[row]; row++ ) {
+        for ( int column = 0; custom_table[row][column]; column++ ) {
+            free( custom_table[row][column] );
+        }
+        free( custom_table[row] );
+    }
+
     int rowCount = m_table->rowCount();
-    char ***custom_table
-            = (char ***)malloc( sizeof(char **) * ( rowCount + 1 ) );
+    custom_table = (char ***)malloc( sizeof(char **) * ( rowCount + 1 ) );
     custom_table[rowCount] = 0;

     int columnCount = m_table->columnCount();
=======================================
--- /trunk/qt4/pref/customwidgets.h     Sat Sep 10 18:09:56 2011
+++ /trunk/qt4/pref/customwidgets.h     Sat Sep 10 18:52:14 2011
@@ -331,6 +331,7 @@
     QPushButton *m_removeButton;
     QPushButton *m_upButton;
     QPushButton *m_downButton;
+    char ***m_customTable;
 private slots:
     void slotItemSelectionChanged();
     void slotAddClicked();

Reply via email to