@@ -47,9 +47,6 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
47
47
// inside the capture if() statement.
48
48
connect ( mProcess , SIGNAL ( finished ( int , QProcess::ExitStatus ) ), this , SLOT ( processExit ( int , QProcess::ExitStatus ) ) );
49
49
50
- // start the process!
51
- mProcess ->start ( action );
52
-
53
50
// Use QgsMessageOutput for displaying output to user
54
51
// It will delete itself when the dialog box is closed.
55
52
mOutput = QgsMessageOutput::createMessageOutput ();
@@ -63,6 +60,9 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
63
60
{
64
61
connect ( mOutputObj , SIGNAL ( destroyed () ), this , SLOT ( dialogGone () ) );
65
62
}
63
+
64
+ // start the process!
65
+ mProcess ->start ( action );
66
66
}
67
67
else
68
68
{
@@ -133,6 +133,8 @@ void QgsRunProcess::dialogGone()
133
133
// class being called after it has been deleted (Qt seems not to be
134
134
// disconnecting them itself)
135
135
136
+ mOutput = 0 ;
137
+
136
138
disconnect ( mProcess , SIGNAL ( error ( QProcess::ProcessError ) ), this , SLOT ( processError ( QProcess::ProcessError ) ) );
137
139
disconnect ( mProcess , SIGNAL ( readyReadStandardOutput () ), this , SLOT ( stdoutAvailable () ) );
138
140
disconnect ( mProcess , SIGNAL ( readyReadStandardError () ), this , SLOT ( stderrAvailable () ) );
@@ -145,7 +147,7 @@ void QgsRunProcess::processError( QProcess::ProcessError err )
145
147
{
146
148
if ( err == QProcess::FailedToStart )
147
149
{
148
- QgsMessageOutput* output = QgsMessageOutput::createMessageOutput ();
150
+ QgsMessageOutput* output = mOutput ? mOutput : QgsMessageOutput::createMessageOutput ();
149
151
output->setMessage ( tr ( " Unable to run command %1" ).arg ( mCommand ), QgsMessageOutput::MessageText );
150
152
// Didn't work, so no need to hang around
151
153
die ();
0 commit comments