@@ -47,9 +47,6 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
4747 // inside the capture if() statement.
4848 connect ( mProcess , SIGNAL ( finished ( int , QProcess::ExitStatus ) ), this , SLOT ( processExit ( int , QProcess::ExitStatus ) ) );
4949
50- // start the process!
51- mProcess ->start ( action );
52-
5350 // Use QgsMessageOutput for displaying output to user
5451 // It will delete itself when the dialog box is closed.
5552 mOutput = QgsMessageOutput::createMessageOutput ();
@@ -64,6 +61,9 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
6461 {
6562 connect ( mOutputObj , SIGNAL ( destroyed () ), this , SLOT ( dialogGone () ) );
6663 }
64+
65+ // start the process!
66+ mProcess ->start ( action );
6767 }
6868 else
6969 {
@@ -134,6 +134,8 @@ void QgsRunProcess::dialogGone()
134134 // class being called after it has been deleted (Qt seems not to be
135135 // disconnecting them itself)
136136
137+ mOutput = 0 ;
138+
137139 disconnect ( mProcess , SIGNAL ( error ( QProcess::ProcessError ) ), this , SLOT ( processError ( QProcess::ProcessError ) ) );
138140 disconnect ( mProcess , SIGNAL ( readyReadStandardOutput () ), this , SLOT ( stdoutAvailable () ) );
139141 disconnect ( mProcess , SIGNAL ( readyReadStandardError () ), this , SLOT ( stderrAvailable () ) );
@@ -146,7 +148,7 @@ void QgsRunProcess::processError( QProcess::ProcessError err )
146148{
147149 if ( err == QProcess::FailedToStart )
148150 {
149- QgsMessageOutput* output = QgsMessageOutput::createMessageOutput ();
151+ QgsMessageOutput* output = mOutput ? mOutput : QgsMessageOutput::createMessageOutput ();
150152 output->setMessage ( tr ( " Unable to run command" ) + mCommand , QgsMessageOutput::MessageText );
151153 // Didn't work, so no need to hang around
152154 die ();
0 commit comments