[vlmc-devel] [PATCH 09/12] MainWindow: Don't use pointers to show QDialogs

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Apr 6 11:19:39 CEST 2016


On 04/06/2016 09:58 AM, Yikai Lu wrote:
> ---
>   src/Gui/MainWindow.cpp | 25 +++++++------------------
>   1 file changed, 7 insertions(+), 18 deletions(-)
>
> diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
> index 75f02c3..8cc1981 100644
> --- a/src/Gui/MainWindow.cpp
> +++ b/src/Gui/MainWindow.cpp
> @@ -601,19 +601,14 @@ MainWindow::checkVideoLength()
>   bool
>   MainWindow::renderVideo( const QString& outputFileName )
>   {
> -    WorkflowFileRendererDialog  *dialog = new WorkflowFileRendererDialog;
> -    dialog->setModal( true );
> -    dialog->setOutputFileName( outputFileName );
> +    WorkflowFileRendererDialog  dialog;
> +    dialog.setModal( true );
> +    dialog.setOutputFileName( outputFileName );
>
>       Core::instance()->workflowRenderer()->startRenderToFile( outputFileName );
>
> -    if ( dialog->exec() == QDialog::Rejected )
> -    {
> -        delete dialog;
> +    if ( dialog.exec() == QDialog::Rejected )
>           return false;
> -    }
> -
> -    delete dialog;
>       return true;
>   }
>
> @@ -622,17 +617,11 @@ MainWindow::renderVideoSettings( bool shareOnInternet )
>   {
>       Core::instance()->workflowRenderer()->stop();
>
> -    RendererSettings *settings = new RendererSettings( shareOnInternet );
> +    RendererSettings settings( shareOnInternet );
>
> -    if ( settings->exec() == QDialog::Rejected )
> -    {
> -        delete settings;
> +    if ( settings.exec() == QDialog::Rejected )
>           return false;
> -    }
> -
> -    delete settings;
> -
> -    return renderVideo( settings->outputFileName() );
> +    return renderVideo( settings.outputFileName() );
>   }
>
>   QDockWidget*
>
Yes please! We need to get rid of all those useless heap allocs


More information about the Vlmc-devel mailing list