summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-07-23 17:06:53 +0200
committerJake Petroules <jake.petroules@petroules.com>2015-07-30 05:33:28 +0000
commitedb5f22b0a5f791728951bc77e272279e06b6ab6 (patch)
treef1472659384f813ca987dd84fbc4f05c343344ad /src/corelib
parent2a382655718dcf8d00822d8fdc1dfdae1666c67e (diff)
consistently handle empty program string in QProcess::start overloads
All overloads of QProcess::start will now check whether the program string is empty and in that case - set error to FailedToStart, - set errorString to "No program defined", - emit error. Until now only one of the three overloads behaved like this. As a side effect, start(QString(), QStringList()) will not crash on Windows anymore. Task-number: QTBUG-47404 Change-Id: I2f93657204fe3643b1d74a74817843c05fc4a96b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qprocess.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 1842541644..914774b433 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -2062,6 +2062,13 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
qWarning("QProcess::start: Process is already running");
return;
}
+ if (program.isEmpty()) {
+ Q_D(QProcess);
+ d->processError = QProcess::FailedToStart;
+ setErrorString(tr("No program defined"));
+ emit error(d->processError);
+ return;
+ }
d->program = program;
d->arguments = arguments;
@@ -2086,7 +2093,10 @@ void QProcess::start(OpenMode mode)
return;
}
if (d->program.isEmpty()) {
- qWarning("QProcess::start: program not set");
+ Q_D(QProcess);
+ d->processError = QProcess::FailedToStart;
+ setErrorString(tr("No program defined"));
+ emit error(d->processError);
return;
}