From d3a38b04c117bb2c7b5cbb6dfa3e7a5a5bb397f5 Mon Sep 17 00:00:00 2001 From: jef Date: Sat, 11 Apr 2009 19:39:15 +0000 Subject: [PATCH] fix #1203 git-svn-id: http://svn.osgeo.org/qgis/trunk@10533 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/core/qgsrunprocess.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/qgsrunprocess.cpp b/src/core/qgsrunprocess.cpp index e66bf1efb4c..f5628f39fa8 100644 --- a/src/core/qgsrunprocess.cpp +++ b/src/core/qgsrunprocess.cpp @@ -47,9 +47,6 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture ) // inside the capture if() statement. connect( mProcess, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( processExit( int, QProcess::ExitStatus ) ) ); - // start the process! - mProcess->start( action ); - // Use QgsMessageOutput for displaying output to user // It will delete itself when the dialog box is closed. mOutput = QgsMessageOutput::createMessageOutput(); @@ -63,6 +60,9 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture ) { connect( mOutputObj, SIGNAL( destroyed() ), this, SLOT( dialogGone() ) ); } + + // start the process! + mProcess->start( action ); } else { @@ -133,6 +133,8 @@ void QgsRunProcess::dialogGone() // class being called after it has been deleted (Qt seems not to be // disconnecting them itself) + mOutput = 0; + disconnect( mProcess, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( processError( QProcess::ProcessError ) ) ); disconnect( mProcess, SIGNAL( readyReadStandardOutput() ), this, SLOT( stdoutAvailable() ) ); disconnect( mProcess, SIGNAL( readyReadStandardError() ), this, SLOT( stderrAvailable() ) ); @@ -145,7 +147,7 @@ void QgsRunProcess::processError( QProcess::ProcessError err ) { if ( err == QProcess::FailedToStart ) { - QgsMessageOutput* output = QgsMessageOutput::createMessageOutput(); + QgsMessageOutput* output = mOutput ? mOutput : QgsMessageOutput::createMessageOutput(); output->setMessage( tr( "Unable to run command %1" ).arg( mCommand ), QgsMessageOutput::MessageText ); // Didn't work, so no need to hang around die();