@@ -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 ();
@@ -63,6 +60,9 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
6360 {
6461 connect ( mOutputObj , SIGNAL ( destroyed () ), this , SLOT ( dialogGone () ) );
6562 }
63+
64+ // start the process!
65+ mProcess ->start ( action );
6666 }
6767 else
6868 {
@@ -133,6 +133,8 @@ void QgsRunProcess::dialogGone()
133133 // class being called after it has been deleted (Qt seems not to be
134134 // disconnecting them itself)
135135
136+ mOutput = 0 ;
137+
136138 disconnect ( mProcess , SIGNAL ( error ( QProcess::ProcessError ) ), this , SLOT ( processError ( QProcess::ProcessError ) ) );
137139 disconnect ( mProcess , SIGNAL ( readyReadStandardOutput () ), this , SLOT ( stdoutAvailable () ) );
138140 disconnect ( mProcess , SIGNAL ( readyReadStandardError () ), this , SLOT ( stderrAvailable () ) );
@@ -145,7 +147,7 @@ void QgsRunProcess::processError( QProcess::ProcessError err )
145147{
146148 if ( err == QProcess::FailedToStart )
147149 {
148- QgsMessageOutput* output = QgsMessageOutput::createMessageOutput ();
150+ QgsMessageOutput* output = mOutput ? mOutput : QgsMessageOutput::createMessageOutput ();
149151 output->setMessage ( tr ( " Unable to run command %1" ).arg ( mCommand ), QgsMessageOutput::MessageText );
150152 // Didn't work, so no need to hang around
151153 die ();
0 commit comments