Revision: 7314
Author:   nogu.dev
Date:     Sun Sep 18 19:48:32 2011
Log:      * qt4/pref/customwidgets.cpp
  - (CustomTable::slotEditButtonClicked):
    Fix crashy code. See also: http://www.kdedevelopers.org/node/3919
http://code.google.com/p/uim/source/detail?r=7314

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

=======================================
--- /trunk/qt4/pref/customwidgets.cpp   Sat Sep 17 03:28:35 2011
+++ /trunk/qt4/pref/customwidgets.cpp   Sun Sep 18 19:48:32 2011
@@ -1258,21 +1258,22 @@

 void CustomTable::slotEditButtonClicked()
 {
-    TableEditForm dialog( this );
-    dialog.setWindowTitle( _FU8( m_custom->label ) );
-    dialog.setTable( m_custom->value->as_table );
+    QPointer<TableEditForm> d = new TableEditForm( this );
+    d->setWindowTitle( _FU8( m_custom->label ) );
+    d->setTable( m_custom->value->as_table );
     int column = 0;
     for ( struct uim_custom_choice **item
             = m_custom->range->as_table_header.valid_items;
             *item; item++ ) {
-        dialog.setTableHeaderItem( _FU8( ( *item )->label ), column );
+        d->setTableHeaderItem( _FU8( ( *item )->label ), column );
         column++;
     }
-    if ( dialog.exec() == QDialog::Accepted ) {
-        m_custom->value->as_table = dialog.table();
+    if ( d->exec() == QDialog::Accepted ) {
+        m_custom->value->as_table = d->table();
         setCustom( m_custom );
         update();
     }
+    delete d;
 }

 TableEditForm::TableEditForm( QWidget *parent )

Reply via email to