diff --git a/clients/oxygen/config/oxygenexceptionlistwidget.cpp b/clients/oxygen/config/oxygenexceptionlistwidget.cpp index d10cfc6aa1..474f2b2a4b 100644 --- a/clients/oxygen/config/oxygenexceptionlistwidget.cpp +++ b/clients/oxygen/config/oxygenexceptionlistwidget.cpp @@ -113,16 +113,24 @@ namespace Oxygen { // map dialog - //QSharedPointer dialog( new ExceptionDialog( this ) ); QPointer dialog = new ExceptionDialog( this ); dialog->setException( _defaultConfiguration ); // run dialog and check existence - if( dialog->exec() == QDialog::Rejected ) return; + if( dialog->exec() == QDialog::Rejected ) + { + delete dialog; + return; + } + + // check dialog if( !dialog ) return; // retrieve exception and check Exception exception( dialog->exception() ); + delete dialog; + + // check exceptions if( !checkException( exception ) ) return; // create new item @@ -136,8 +144,6 @@ namespace Oxygen ui.exceptionListView->selectionModel()->setCurrentIndex( index, QItemSelectionModel::Current|QItemSelectionModel::Rows ); } - delete dialog; - resizeColumns(); emit changed(); return; @@ -155,12 +161,22 @@ namespace Oxygen Exception& exception( model().get( current ) ); // create dialog - QSharedPointer dialog( new ExceptionDialog( this ) ); + QPointer dialog( new ExceptionDialog( this ) ); dialog->setException( exception ); // map dialog - if( dialog->exec() == QDialog::Rejected ) return; + if( dialog->exec() == QDialog::Rejected ) + { + delete dialog; + return; + } + + // check dialog + if( !dialog ) return; + + // retrieve exception Exception newException = dialog->exception(); + delete dialog; // check if exception was changed if( exception == newException ) return; @@ -170,6 +186,7 @@ namespace Oxygen // asign new exception *&exception = newException; + resizeColumns(); emit changed(); return; @@ -316,11 +333,16 @@ namespace Oxygen { KMessageBox::error( this, i18n("Regular Expression syntax is incorrect") ); - QSharedPointer dialog( new ExceptionDialog( this ) ); + QPointer dialog( new ExceptionDialog( this ) ); dialog->setException( exception ); - if( dialog->exec() == QDialog::Rejected ) return false; - exception = dialog->exception(); + if( dialog->exec() == QDialog::Rejected ) + { + delete dialog; + return false; + } + exception = dialog->exception(); + delete dialog; } return true;